The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Domestic Violence » merging HIV results and couples data
Re: merging HIV results and couples data [message #9548 is a reply to message #9537] Tue, 12 April 2016 13:00 Go to previous message
user-rhs is currently offline  user-rhs
Messages: 132
Registered: December 2013
Senior Member
That's because the IR file only contains information on women. If the women's dataset is the one in memory ("master," the dataset that you have opened), as it is in Trevor's code, and the HIV dataset is one you're merging it with ("using," the dataset that comes after "using" in the -merge- command), then, based on the coding for the resultant _merge variable (which, by the way, merge results are shown immediately after a merge):

numeric    equivalent
code      word (results)     description
-------------------------------------------------------------------
1       master             observation appeared in master only
2       using              observation appeared in using only
3       match              observation appeared in both

4       match_update       observation appeared in both,   
                           missing values updated
5       match_conflict     observation appeared in both,
                           conflicting nonmissing values
-------------------------------------------------------------------
Source: -help merge-


You can see that _merge==2 means that the unique identifier existed in the using/HIV data only, and not the women's/master dataset.


Stata keeps all observations, regardless of matching status, unless you specify to keep just the ones in the master dataset or in the using dataset, i.e., supposing you have IR dataset in memory:

merge 1:1 v001 v002 v003 using "HIV.dta", assert(match master) /*Keeps only those who are in the IR dataset, regardless of matching status*/
merge 1:1 v001 v002 v003 using "HIV.dta",assert(match using) /*Keeps only those in the HIV dataset, regardless of matching status and therefore sex of the respondent*/



hth,
rhs

[Updated on: Tue, 12 April 2016 13:01]

Report message to a moderator

 
Read Message
Read Message
Previous Topic: Nepal 2011 Men's Attitudes about when Beating Wife is Justified
Next Topic: Zimbabwe (2005) and Cameroon (2004) - computing 12 months prevalence
Goto Forum:
  


Current Time: Thu Nov 28 04:40:25 Coordinated Universal Time 2024