


It consists of four variables: a treatment indicator t, covariates x1 and x2, and an outcome y. Run the following command in Stata to load an example data set: We thus strongly recommend switching from psmatch2 to teffects psmatch, and this article will help you make the transition. This often turns out to make a significant difference, and sometimes in surprising ways. The teffects psmatch command has one very important advantage over psmatch2: it takes into account the fact that propensity scores are estimated rather than known when calculating standard errors. However, Stata 13 introduced a new teffects command for estimating treatments effects in a variety of ways, including propensity score matching. Read more about Jeff here.Note: readers interested in this article should also be aware of King and Nielson's 2019 paper Why Propensity Scores Should Not Be Used for Matching.įor many years, the standard tool for propensity score matching in Stata has been the psmatch2 command, written by Edwin Leuven and Barbara Sianesi. Jeff Meyer is a statistical consultant with The Analysis Factor, a stats mentor for Statistically Speaking membership, and a workshop instructor.
#Stata commands free#
This is one of the five tips and tricks I’ll be discussing during the free Stata webinar on Wednesday, July 29th. Graph twoway (line lfp year) (line College year) (line Mobil year), ylabel(, angle(horizontal)) In this situation I will use the population variable.Ĭollapse (mean) lfp College Mobil, by(year) You have to determine which variable to use. What if I want to look at variables that are in percentages, such as percent of college graduates, mobility and labor force participation rate (lfp)? In this case I don’t want to sum the values because they are in percent.Ĭalculating the mean would give equal weighting to all counties regardless of size.įortunately Stata gives you a very simple way to weight your data based on frequency.
#Stata commands code#
Graph twoway (line Pop year) (line Jobs year), ylabel(, angle(horizontal))īy starting my code with the preserve command it brings my data set back to its original state after providing me with the results I want. I want results that I can copy and paste into a Word document. What if I wanted to see some trend information, such as the total population and jobs per decade for all of Alabama? I just want a simple table to see my results as well as a graph. Five time periods by 67 counties give me a total of 335 observations. The time frame is in decades, from 1960 to 2000. I’m currently looking at a longitudinal data set filled with economic data on all 67 counties in Alabama. Collapse allows you to convert your current data set to a much smaller data set of means, medians, maximums, minimums, count or percentiles (your choice of which percentile). Get to know Stata’s collapse command–it’s your new friend.
#Stata commands how to#
Have you ever worked with a data set that had so many observations and/or variables that you couldn’t see the forest for the trees? You would like to extract some simple information but you can’t quite figure out how to do it.
