Merge a country level variable [message #1162] |
Tue, 14 January 2014 23:09 |
zurbaeva
Messages: 1 Registered: January 2014
|
Member |
|
|
Hello, I would like to include a country-level indicator in my analysis. Specifically, I would like to include a human development index from UNDP in my analysis. Is there a way to include it in STATA? Thank you,
|
|
|
Re: Merge a country level variable [message #1165 is a reply to message #1162] |
Wed, 15 January 2014 13:41 |
Reduced-For(u)m
Messages: 292 Registered: March 2013
|
Senior Member |
|
|
Here is how I do it. Make a dataset with just name of country (variable called "country") and the variable you want to add - making sure that name of country is spelled the same way in both your DHS set and your add-on set (you could generate a country ID code instead - what I tend to do is, when appending all my various countries' DHS data together, I add in a country name variable to the DHS data that adds the new country's name each time it appends - then save that as something like "DHSdata.dta").
Then you just open the data with the new information, and use:
merge 1:m country using "DHSdata.dta"
... that should do it. If not, check out the Stata help file on "merge", or ask back here. But it should be really simple once you get a variable for country in both datasets.
|
|
|