The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » General » Merging datasets (Disability and women's questionnaire)
Re: Merging datasets [message #24038 is a reply to message #24030] Tue, 08 February 2022 09:48 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3035
Registered: February 2013
Senior Member
Following is a response from DHS Senior Analysis & Research Manager, Shireen Assaf:

We do not use SPSS but the following resources may help.

You may be able to borrow the logic from how a merge is done in Stata: https://github.com/DHSProgram/DHS-Analysis-Code/tree/main/Me rgeCode

The Guide to DHS statistics has a section on merging and includes some SPSS code: https://www.dhsprogram.com/Data/Guide-to-DHS-Statistics/inde x.htm#t=Analyzing_DHS_Data.htm&rhsearch=merge&rhhlte rm=merge&rhsyns=%20

There is an example of a merge in our SPSS code on GitHub. See the NT_main.sps file here: https://github.com/DHSProgram/DHS-Indicators-SPSS/blob/maste r/Chap11_NT/!NTmain.sps

The relevant code is given below, for merging the KR code with the HR file. You would be using different files, the IR and PR and would to rename hvidx to v003 see how this is done in Stata here: https://github.com/DHSProgram/DHS-Analysis-Code/blob/main/Me rgeCode/mergePR_toKRorIR.do

* Note: For the NT_MICRO sps file, you need to merge the KR with the HR file. 
* The merge will be performed before running any of the do files below. 

get file =  datapath + "\"+ hrdata + ".sav"
/rename (hv001=v001) (hv002=v002)
/keep v001 v002 hv234a.

save outfile = datapath + "\temp.sav".

* open KR dataset.
get file =  datapath + "\"+ krdata + ".sav".
match files
/file=*
/table= datapath + "\temp.sav"
/by v001 v002.
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Create a daughters' file on Stata
Next Topic: Cervical cancer Rwanda 2019
Goto Forum:
  


Current Time: Fri Apr 19 11:19:35 Coordinated Universal Time 2024