Note 1:
For example, users frequently wish to attach the characteristics of immediate family members. The following SPSS-X command file uses SPLOC to attach the spouse's occupation to the record of each married person. SERIAL is an IPUMS variable, Household serial number, which is a unique identifier for each household. First we obtain an active file with SERIAL, OCC (Occupation), and SPLOC. SPLOC is renamed PERNUM (Person number in unit), and we rename OCC as "SPOCC," Spouse's occupation—the variable we have constructed for our own use. We sort the file by SERIAL and PERNUM, and then match it to the original file. Because the PERNUM we are matching was originally SPLOC, we are actually matching spousal occupations:
GET FILE='IPUMS.SYS' /KEEP SERIAL SPLOC OCC
/RENAME (PERNUM=SPLOC)(SPOCC=OCC)
SORT CASES BY SERIAL, PERNUM
MATCH FILES TABLE=* /FILE='IPUMS.SYS' /BY SERIAL,
PERNUM
SAVE OUTFILE='IPUMS2.SYS'
FINISH
It is almost as easy to use MOMLOC and POPLOC to attach characteristics of own children. The following SPSS-X command file uses similar logic together with the AGGREGATE command to count the number of own children under the age of 10 for each woman:
GET FILE='IPUMS2.SYS' /KEEP SERIAL MOMLOC AGE
/RENAME (PERNUM=MOMLOC)
SELECT IF (AGE LT 10 AND PERNUM GT 0)
SORT CASES BY SERIAL, PERNUM
AGGREGATE OUTFILE=* /BREAK SERIAL PERNUM
/CHLT10=N
MATCH FILE TABLE=* /FILE='IPUMS.SYS' /BY SERIAL,
PERNUM
IF (MISSING(CHLT10)) CHLT10=0
SAVE OUTFILE='IPUMS3.SYS'
FINISH
|