Picture this: You are using individual data from one data source (actually, in my case, it was nursing home level data), but you want to merge in state-level data from a different data source. The good news: you have information on state in both data sources. The bad news: in one data set, state abbreviations are used (CT, RI..) and in the other, you have state FIPS codes. Sure, you can google "State FIPS code" and probably pretty quickly get a nice cross-walk, but there's another way. Install the ado file, "statastates" (type "ssc install statastates" into Stata). Then you just write in the type of code you have for Stata and it will add to your data set the other code types. Super easy and convenient! I used it this week. Thank you, William Schpero for sharing that ado file with the world.
And now a secret. Or maybe a warning. Here it is: You will make coding errors.
You can make fewer of them by being careful and checking your work, etc. But even then, you will make coding errors. Most of the time, people catch these coding errors eventually, but trust me, your life will be easier if you catch them as soon as possible after you make them. How to do that? Check your data often! I've blogged before about carefully looking at tables of descriptive statistics but here's another nifty trick: whenever possible, use the "assert" command in Stata. Nick Eubank provides a nice description of how to use this effectively.
Warning: an annoying thing about using cool ado files is that when you use a new computer, you have to re-install all of the ado files. Yes, that's pretty quick and easy, but still annoying.
ReplyDelete