Posts tagged "stata" | Johan Osterberg - Product Engineer

Posts tagged: stata

71 posts

  1. April 09, 2020

    In this post we look at how you would import a R dataset into Stata. In particular we will export the happy dataset which is in the…

  2. June 16, 2019

    Let's look at an alternate way of performing a chi-square test in Stata, this time using the tabi command. First, let's load up the auto…

  3. June 08, 2019

    The list command is one of the most useful commands in Stata when inspecting data. In this post we'll look at some ways we can list the…

  4. June 04, 2019

    In a recent post we looked at listing percentiles of a variable. When it comes to getting an overview of a variable perhaps the simplest and…

  5. June 03, 2019

    Sometimes you want to display the percentiles of a variable to get an idea of how values are distributed. One way of achieving this is by…

  6. June 01, 2019

    In this post we'll look at some tips to get the most out of the Stata help. In order to use Stata effectively it's crucial to get a good…

  7. May 29, 2019

    In order to get the unique values of a variable (for example how many times an identifier occurs among observations) there are a few…

  8. May 27, 2019

    In this post we'll look at some Stata tips that might be useful if you're coming from a SQL background (like myself). This will likely be a…

  9. May 25, 2019

    Bar charts are another graphing tool that can be used for example when exploring relationships between variables. Let's look at an example…

  10. May 23, 2019

    In the last post we looked at linear fit in order to visualize relationships between two variables. For instance we can explore the…

  11. May 19, 2019

    The webuse command is used to load datasets directly from the Stata website. This is convenient as you dont have to download datasets…

  12. May 18, 2019

    The bysort command in Stata is used as a prefix before other commands, and it allows you to perform those commands within groups of…

  13. May 11, 2019

    The notes command is used for attaching notes to a variable. Can be useful in when it might be hard to interpret a variable, or when any…

  14. May 10, 2019

    Looping in Stata is mainly achieved by use of the foreach command. Using the nlsw88 dataset we'll generate a new variable with observations…

  15. May 07, 2019

    The two main commands used in Stata when working with strings are tostring, destring, encode and decode. For this example, let's load the…

  16. May 06, 2019

    Instead of using the split command for string manipulation we can use the word function. Looking at a previous example of transforming the…

  17. May 05, 2019

    Let's look at another example of recoding in Stata, this time using the split command. For this example we'll use the variable make in the…

  18. April 29, 2019

    Creating binary variables in Stata is useful for many purposes, for example if you quickly need to get an overview of a variable with a…

  19. April 28, 2019

    Sometimes you need to split a variable into groups. There are several ways to achieve this in Stata, in this post we'll use the egen command…

  20. April 26, 2019

    As an alternative to dropping variables, it's possible to choose which ones to keep in a dataset. You can use the Variables Manager in Stata…

  21. April 23, 2019

    If you have two (or more) datasets that you want to combine, this can be achieved by using either the append or merge commands. The main use…

  22. April 22, 2019

    Dropping values in Stata is achieved by the drop command. Let's load the auto training dataset and create a new variable: That's just a new…

  23. April 16, 2019

    Let's look at some examples of recoding variables in Stata. First off we'll recode a numeric variable into categories using the auto dataset…

  24. April 15, 2019

    Recoding variables in Stata is very simple. It is useful in many scenarios, for instance where you would want to merge a variable containing…

  25. April 12, 2019

    When working with long commands sometimes you want to split them into several lines in your do-files, for brevity or readability (or…

  26. April 11, 2019

    In a previous post we looked at working with log files in Stata. As discussed in that post, Stata files take the file extenstion .smcl. If…

  27. April 11, 2019

    Log files in Stata can be useful if you want to keep track of your work over time, simply because it enables you to save your session for…

2026 © Johan Osterberg