Family Data » Creating Parent Files with One Record Per Respondent »

SPSS Code for:  [2000] [1998] [1996] [1994] [1992]


Respondent Record with Mother and Father Variables: 2000

Note: Modify variable list as needed; for a listing of parent (and equivalent parent-in-law) variables consult the 2000 Parent to Parent-in-Law Variables Cross-Reference Table .

/*  STEP 1:  PARENT INFORMATION FOR FAMILY RESPONDENTS' PARENTS
GET FILE "C:\HRS2000\SPSS\H00D_H.sav".
STRING   PN (A3)
         GPN_SP (A3).

USE ALL.
SELECT IF (GPN_FAM NE '').

COMPUTE PN  =GPN_FAM.
COMPUTE GPN_SP=GPN_NFAM.

SORT CASES BY HHID (A) PN (A).
/*  KEEP PARENT VARIABLES OF INTEREST
SAVE OUTFILE='c:\temp\FAMR.sav'/ keep=HHID PN GPN_SP GSUBHH
                                      G2122 G2132.
EXECUTE.

/*  STEP 2:  PARENT INFORMATION FOR NON-FAMILY RESPONDENTS' PARENTS
GET FILE "C:\HRS2000\SPSS\H00D_H.sav".

STRING   PN (A3)
         GPN_SP (A3).

USE ALL.
SELECT IF (GPN_NFAM NE '').

COMPUTE PN  =GPN_NFAM.
COMPUTE GPN_SP=GPN_FAM.

/*  copy parent-in-law variables to output variables locations
COMPUTE G2122=G2309.
COMPUTE G2132=G2319.

SORT CASES BY HHID (A) PN (A).
/*  KEEP PARENT VARIABLES OF INTEREST
SAVE OUTFILE='c:\temp\NFAMR.sav'/ keep=HHID PN GPN_SP GSUBHH
                                      G2122 G2132.
EXECUTE.

/*  STEP 3:  CONCATENATE TWO PARENT FILES
MATCH FILES
/FILE="c:\temp\FAMR.sav"
/FILE="c:\temp\NFAMR.sav"
/BY HHID PN.
SAVE OUTFILE='c:\temp\PARENTS.sav'.
Top


Respondent Record with Mother and Father Variables: 1998

Note: Modify variable list as needed; for a listing of parent (and equivalent parent-in-law) variables consult the 1998 Parent to Parent-in-Law Variables Cross-Reference Table .

/*  STEP 1:  PARENT INFORMATION FOR FAMILY RESPONDENTS' PARENTS
GET FILE "C:\HRS1998\SPSS\H98D_H.sav".

STRING   PN (A3)
         FPN_SP (A3).

USE ALL.
SELECT IF (FPN_FAM NE '').

COMPUTE PN  =FPN_FAM.
COMPUTE FPN_SP=FPN_NFAM.

SORT CASES BY HHID (A) PN (A).
/*  KEEP PARENT VARIABLES OF INTEREST
SAVE OUTFILE='c:\temp\FAMR.sav'/ keep=HHID PN FPN_SP FSUBHH
                                      F1906 F1916.
EXECUTE.

/*  STEP 2:  PARENT INFORMATION FOR NON-FAMILY RESPONDENTS' PARENTS
GET FILE "C:\HRS1998\SPSS\H98D_H.sav".

STRING   PN (A3)
         FPN_SP (A3).

USE ALL.
SELECT IF (FPN_NFAM NE '').

COMPUTE PN  =FPN_NFAM.
COMPUTE FPN_SP=FPN_NFAM.

/*  copy parent-in-law variables to output variables locations
COMPUTE F1906=F2068.
COMPUTE F1916=F2078.

SORT CASES BY HHID (A) PN (A).
/*  KEEP PARENT VARIABLES OF INTEREST
SAVE OUTFILE='c:\temp\NFAMR.sav'/ keep=HHID PN FPN_SP FSUBHH
                                      F1906 F1916.
EXECUTE.

/*  STEP 3:  CONCATENATE TWO PARENT FILES
MATCH FILES
/FILE="c:\temp\FAMR.sav"
/FILE="c:\temp\NFAMR.sav"
/BY HHID PN.
SAVE OUTFILE='c:\temp\PARENTS.sav'.
Top


Respondent Record with Mother and Father Variables: 1996

Note: Modify variable list as needed; for a listing of parent (and equivalent parent-in-law) variables consult the 1996 Parent to Parent-in-Law Variables Cross-Reference Table .

/*  STEP 1:  PARENT INFORMATION FOR FAMILY RESPONDENTS' PARENTS
GET FILE "C:\HRS1996\SPSS\H96D_H.sav".

STRING   PN (A3)
         EPN_SP (A3).

USE ALL.
SELECT IF (EPN_FAM NE '').

COMPUTE PN  =EPN_FAM.
COMPUTE EPN_SP=EPN_NFAM.

SORT CASES BY HHID (A) PN (A).
/*  KEEP PARENT VARIABLES OF INTEREST
SAVE OUTFILE='c:\temp\FAMR.sav'/ keep=HHID PN EPN_SP ESUBHH
                                      E1557_1 E1566_1.
EXECUTE.

/*  STEP 2:  PARENT INFORMATION FOR NON-FAMILY RESPONDENTS' PARENTS
GET FILE "C:\HRS1996\SPSS\H96D_H.sav".

STRING   PN (A3)
         EPN_SP (A3).

USE ALL.
SELECT IF (EPN_NFAM NE '').

COMPUTE PN  =EPN_NFAM.
COMPUTE EPN_SP=EPN_NFAM.

/*  copy parent-in-law variables to output variables locations
COMPUTE E1557_1=E1557_2.
COMPUTE E1566_1=E1566_2A.

SORT CASES BY HHID (A) PN (A).
/*  KEEP PARENT VARIABLES OF INTEREST
SAVE OUTFILE='c:\temp\NFAMR.sav'/ keep=HHID PN EPN_SP ESUBHH
                                      E1557_1 E1566_1.
EXECUTE.

/*  STEP 3:  CONCATENATE TWO PARENT FILES
MATCH FILES
/FILE="c:\temp\FAMR.sav"
/FILE="c:\temp\NFAMR.sav"
/BY HHID PN.
SAVE OUTFILE='c:\temp\PARENTS.sav'.

Top


Respondent Record with Mother and Father Variables: 1994

/*  REFORMAT PARENTS FILE TO ONE PER RESPONDENT
GET FILE "C:\HRS1994\SPSS\W2PARS.SAV".

/*  STEP 1: SORT W2PARS FILE
SORT CASES BY HHID (A) PN (A) CSUBHH (A).
SAVE OUTFILE='c:\temp\W2PARS.sav'/COMPRESSED.
EXECUTE.

/*  STEP 2: CREATE FILE WITH MOTHER RECORDS
GET FILE "c:\temp\W2PARS.sav" /keep = CPARCODE
          HHID PN CSUBHH ASUBHH CPN_SP COPN_CS CCSR CFAMR CFINR RPN FAMFLAG
          W8201 W8202 W8203 W8204 W8205 W8206 W8207 W8208 W8209 W8210 W8211
          W8213 W8214 W8215 W8216 W8217 W8218 W8219.

USE ALL.
SELECT IF (CPARCODE EQ '1').

    RENAME variables
    W8201   = W8201M
    W8202   = W8202M
    W8203   = W8203M
    W8204   = W8204M
    W8205   = W8205M
    W8206   = W8206M
    W8207   = W8207M
    W8208   = W8208M
    W8209    = W8209M
    W8210    = W8210M
    W8211    = W8211M
    W8213    = W8213M
    W8214    = W8214M
    W8215    = W8215M
    W8216    = W8216M
    W8217    = W8217M
    W8218    = W8218M
    W8219    = W8219M
    .
SAVE OUTFILE='c:\temp\MOM.sav'/ drop=CPARCODE.
EXECUTE.

/*  STEP 3: CREATE FILE WITH FATHER RECORDS
GET FILE "c:\temp\W2PARS.sav" /keep = CPARCODE
          HHID PN CSUBHH ASUBHH CPN_SP COPN_CS CCSR CFAMR CFINR RPN FAMFLAG
          W8201 W8202 W8203 W8204 W8205 W8206 W8207 W8208 W8209 W8210 W8211
          W8213 W8214 W8215 W8216 W8217 W8218 W8219.

USE ALL.
SELECT IF (CPARCODE EQ '2').

    RENAME variables
    W8201   = W8201F
    W8202   = W8202F
    W8203   = W8203F
    W8204   = W8204F
    W8205   = W8205F
    W8206   = W8206F
    W8207   = W8207F
    W8208   = W8208F
    W8209    = W8209F
    W8210    = W8210F
    W8211    = W8211F
    W8213    = W8213F
    W8214    = W8214F
    W8215    = W8215F
    W8216    = W8216F
    W8217    = W8217F
    W8218    = W8218F
    W8219    = W8219F
    .
SAVE OUTFILE='c:\temp\DAD.sav'/ drop=CPARCODE.
EXECUTE.

/*  STEP 4: CREATE FILE WITH PARENT RECORDS
GET FILE "c:\temp\W2PARS.sav" /keep = CPARCODE
          HHID PN CSUBHH ASUBHH CPN_SP COPN_CS CCSR CFAMR CFINR RPN FAMFLAG
          W8209 W8210 W8211 W8212 W8213 W8214 W8215 W8216 W8217 W8218 W8219.

USE ALL.
SELECT IF (CPARCODE EQ '3').

    RENAME variables
    W8209    = W8209P
    W8210    = W8210P
    W8211    = W8211P
    W8212    = W8212P
    W8213    = W8213P
    W8214    = W8214P
    W8215    = W8215P
    W8216    = W8216P
    W8217    = W8217P
    W8218    = W8218P
    W8219    = W8219P
    .
SAVE OUTFILE='c:\temp\PARENT.sav'/ drop=CPARCODE.
EXECUTE.

/*  STEP 5: MERGE MOTHER FATHER AND PARENT FILES
MATCH FILES
 /FILE="c:\temp\MOM.sav"
 /FILE="c:\temp\DAD.sav"
 /FILE="c:\temp\PARENT.sav"
 /BY HHID PN CSUBHH.
SAVE OUTFILE='c:\temp\PARENTS.sav'.
EXECUTE.
Top


Respondent Record with Mother and Father Variables: 1992

/*  REFORMAT PARENTS FILE FROM ONE PER PARENT TO ONE PER RESPONDENT
GET FILE "C:\HRS1992\SPSS\PARENTS.sav".

/*  STEP 1: SORT PARENTSW FILE
SORT CASES BY HHID (A) PN (A).
SAVE OUTFILE='c:\temp\PARENT1.sav'/COMPRESSED.


/*  STEP 2: CREATE FILE WITH MOTHER RECORDS
GET FILE "c:\temp\PARENT1.sav" /keep = ATYPEPAR
     HHID PN ASUBHH APN_SP AFAMR AFINR V1 V2 V3
     V8201 V8202 V8203 V8204 V8205 V8206 V8207
     V8208 V8209 V8210 V8211 V8212 V8213 V8214
     V8215 V8216 V8217 V8218 V8219 V8220 V8221 V8222 V8223 V8224
     V18205 V18206 V18207 V18208 V18209 V18210 V18211 V18213 V18214
     V18215 V18216 V18217 V18218 V18219 V18220 V18221 V18222 V18223 V18224.

USE ALL.
SELECT IF (ATYPEPAR EQ '1').

    RENAME variables
    V8201 = V8201M
    V8202 = V8202M
    V8203 = V8203M
    V8204 = V8204M
    V8205 = V8205M
    V8206 = V8206M
    V8207 = V8207M
    V8208 = V8208M
    V8209 = V8209M
    V8210 = V8210M
    V8211 = V8211M
    V8212 = V8212M
    V8213 = V8213M
    V8214 = V8214M
    V8215 = V8215M
    V8216 = V8216M
    V8217 = V8217M
    V8218 = V8218M
    V8219 = V8219M
    V8220 = V8220M
    V8221 = V8221M
    V8222 = V8222M
    V8223 = V8223M
    V8224 = V8224M
    V18205 = V18205M
    V18206 = V18206M
    V18207 = V18207M
    V18208 = V18208M
    V18209 = V18209M
    V18210 = V18210M
    V18211 = V18211M
    V18213 = V18213M
    V18214 = V18214M
    V18215 = V18215M
    V18216 = V18216M
    V18217 = V18217M
    V18218 = V18218M
    V18219 = V18219M
    V18220 = V18220M
    V18221 = V18221M
    V18222 = V18222M
    V18223 = V18223M
    V18224 = V18224M
    .
SAVE OUTFILE='c:\temp\MOTHERS.sav' /drop = ATYPEPAR.
EXECUTE.


/*  STEP 3: CREATE FILE WITH FATHER RECORDS
GET FILE "c:\temp\PARENT1.sav" /keep = ATYPEPAR
     HHID PN ASUBHH APN_SP AFAMR AFINR V1 V2 V3
     V8201 V8202 V8203 V8204 V8205 V8206 V8207
     V8208 V8209 V8210 V8211 V8212 V8213 V8214
     V8215 V8216 V8217 V8218 V8219 V8220 V8221 V8222 V8223 V8224
     V18205 V18206 V18207 V18208 V18209 V18210 V18211 V18213 V18214
     V18215 V18216 V18217 V18218 V18219 V18220 V18221 V18222 V18223 V18224.

USE ALL.
SELECT IF (ATYPEPAR EQ '2').

    RENAME variables
    V8201 = V8201F
    V8202 = V8202F
    V8203 = V8203F
    V8204 = V8204F
    V8205 = V8205F
    V8206 = V8206F
    V8207 = V8207F
    V8208 = V8208F
    V8209 = V8209F
    V8210 = V8210F
    V8211 = V8211F
    V8212 = V8212F
    V8213 = V8213F
    V8214 = V8214F
    V8215 = V8215F
    V8216 = V8216F
    V8217 = V8217F
    V8218 = V8218F
    V8219 = V8219F
    V8220 = V8220F
    V8221 = V8221F
    V8222 = V8222F
    V8223 = V8223F
    V8224 = V8224F
    V18205 = V18205F
    V18206 = V18206F
    V18207 = V18207F
    V18208 = V18208F
    V18209 = V18209F
    V18210 = V18210F
    V18211 = V18211F
    V18213 = V18213F
    V18214 = V18214F
    V18215 = V18215F
    V18216 = V18216F
    V18217 = V18217F
    V18218 = V18218F
    V18219 = V18219F
    V18220 = V18220F
    V18221 = V18221F
    V18222 = V18222F
    V18223 = V18223F
    V18224 = V18224F
    .
SAVE OUTFILE='c:\temp\FATHERS.sav' /drop = ATYPEPAR.
EXECUTE.

/*  STEP 4: MERGE MOTHER AND FATHER FILES
MATCH FILES
 /FILE="c:\temp\MOTHERS.sav"
 /FILE="c:\temp\FATHERS.sav"
 /BY HHID PN.
SAVE OUTFILE='c:\temp\PARENTS.sav'.
EXECUTE.
Top

Copyright © 2014 The Regents of the University of Michigan