The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Merging data files » merging height weight file to children's file in SPSS
merging height weight file to children's file in SPSS [message #4157] Thu, 09 April 2015 22:15 Go to next message
avr25 is currently offline  avr25
Messages: 3
Registered: April 2015
Member
I'm trying to figure out how to merge the children's file and height weight file in SPSS. I see that the topic has been mentioned for merging in stata, but I can't find any reference to how to do it in SPSS. If anyone can kindly provide some help or provide the forum link to when merging in SPSS for these two specific files were discussed that'd be great!
Re: merging height weight file to children's file in SPSS [message #4166 is a reply to message #4157] Sat, 11 April 2015 16:43 Go to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 787
Registered: January 2013
Senior Member
You can use code like the following to match the height and weight data to the Children's Recode (KR) file:

* Open Height and weight data file.
GET FILE='ZWHW51FL.SAV'.
* Sort the file.
SORT CASES BY HWHHID, HWLINE.
* Save the sorted data file.
SAVE OUTFILE='ZWHW51FL.SAV'.

* Open Child's recode data.
GET FILE='ZWKR51FL.SAV'.
* Create matching ID variables.
STRING HWHHID (A12).
COMPUTE HWHHID = SUBSTR(CASEID, 1, 12).
* Sort the data file on the matching fields.
SORT CASES BY HWHHID, B16.

* Match the HW file to the KR file.
MATCH FILES /FILE=*
  /TABLE='ZWHW51FL.SAV'
  /RENAME HWLINE=B16
  /BY HWHHID, B16.


Note that this code works when you are matching height and weight data collected at the household level with the children's recode (KR) file. There are two other variations that exist - matching height and weight data collected at the household level with the children's data in the Person's Recode (PR) file; and matching data collected at the individual level with the children's recode (KR) file (used in the earlier DHS surveys). These other variations require somewhat different approaches. The document merge.doc that is distributed with the HW data files describes each approach.
  • Attachment: MERGE.DOC
    (Size: 41.00KB, Downloaded 798 times)
Previous Topic: merging different countries data
Next Topic: Merging Hiv Women Men and Couples
Goto Forum:
  


Current Time: Fri Mar 29 01:44:56 Coordinated Universal Time 2024