The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Reproductive Health » Merge a country level variable
Re: Merge a country level variable [message #1165 is a reply to message #1162] Wed, 15 January 2014 13:41 Go to previous message
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.
 
Read Message
Read Message
Previous Topic: Antenatal vs. prenatal
Next Topic: Age at menarche UDHS 2011
Goto Forum:
  


Current Time: Sat Jan 25 13:52:18 Coordinated Universal Time 2025