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

SAS 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;
DATA FAMR;

    *   TO CONTROL POSITION IN OUTPUT FILE;
    ATTRIB
    HHID LABEL='HOUSEHOLD IDENTIFIER' FORMAT=$CHAR6.
    PN LABEL='PERSON NUMBER' FORMAT=$CHAR3.
    GPN_SP LABEL='2000 SPOUSE/PARTNER PERSON NUMBER' FORMAT=$CHAR3.
    GSUBHH LABEL='2000 SUB-HOUSEHOLD IDENTIFIER' FORMAT=$CHAR1.
    ;

    SET IN.H00D_H;
    WHERE GPN_FAM NE '';

    PN=GPN_FAM;
    GPN_SP=GPN_NFAM;
    KEEP HHID PN GPN_SP GSUBHH;

    *   KEEP PARENT VARIABLES OF INTEREST;
    KEEP G2122 G2132;
RUN;

*   STEP 2:  PARENT INFORMATION FOR NON-FAMILY RESPONDENTS' PARENTS;
DATA NFAMR;
    SET IN.H00D_H;
    WHERE GPN_NFAM NE '';

    PN=GPN_NFAM;
    GPN_SP=GPN_FAM;
    KEEP HHID PN GPN_SP GSUBHH;

    *   COPY PARENT-IN-LAW VARIABLES TO OUTPUT VARIABLES LOCATIONS;
    G2122=G2309;
    G2132=G2319;
    KEEP G2122 G2132;
RUN;

*   STEP 3:  CONCATENATE TWO PARENT FILES;
DATA PARENTS;
    SET FAMR NFAMR;
RUN;
PROC SORT DATA=PARENTS;
    BY HHID PN;
RUN;
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;
DATA FAMR;

    *   TO CONTROL POSITION IN OUTPUT FILE;
    ATTRIB
    HHID LABEL='HOUSEHOLD IDENTIFIER' FORMAT=$CHAR6.
    PN LABEL='PERSON NUMBER' FORMAT=$CHAR3.
    FPN_SP LABEL='1998 SPOUSE/PARTNER PERSON NUMBER' FORMAT=$CHAR3.
    FSUBHH LABEL='1998 SUB-HOUSEHOLD IDENTIFIER' FORMAT=$CHAR1.
    ;

    SET IN.H98D_H;
    WHERE FPN_FAM NE '';

    PN=FPN_FAM;
    FPN_SP=FPN_NFAM;
    KEEP HHID PN FPN_SP FSUBHH;

    *   KEEP PARENT VARIABLES OF INTEREST;
    KEEP F1906 F1916;
RUN;

*   STEP 2:  PARENT INFORMATION FOR NON-FAMILY RESPONDENTS' PARENTS;
DATA NFAMR;
    SET IN.H98D_H;
    WHERE FPN_NFAM NE '';

    PN=FPN_NFAM;
    FPN_SP=FPN_FAM;
    KEEP HHID PN FPN_SP FSUBHH;

    *   COPY PARENT-IN-LAW VARIABLES TO OUTPUT VARIABLES LOCATIONS;
    F1906=F2068;
    F1916=F2078;
    KEEP F1906 F1916;
RUN;

*   STEP 3:  CONCATENATE TWO PARENT FILES;
DATA PARENTS;
    SET FAMR NFAMR;
RUN;

PROC SORT DATA=PARENTS;
    BY HHID PN;
RUN;
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;
DATA FAMR;

    *   TO CONTROL POSITION IN OUTPUT FILE;
    ATTRIB
    HHID LABEL='HOUSEHOLD IDENTIFIER' FORMAT=$CHAR6.
    PN LABEL='PERSON NUMBER' FORMAT=$CHAR3.
    EPN_SP LABEL='1996 SPOUSE/PARTNER PERSON NUMBER' FORMAT=$CHAR3.
    ESUBHH LABEL='1996 SUB-HOUSEHOLD IDENTIFIER' FORMAT=$CHAR1.
    ;

    SET IN.H96D_H;
    WHERE EPN_FAM NE '';

    PN=EPN_FAM;
    EPN_SP=EPN_NFAM;
    KEEP HHID PN EPN_SP ESUBHH;

    *   KEEP PARENT VARIABLES OF INTEREST;
    KEEP E1557_1 E1566_1;
RUN;

*   STEP 2:  PARENT INFORMATION FOR NON-FAMILY RESPONDENTS' PARENTS;
DATA NFAMR;
    SET IN.H96D_H;
    WHERE EPN_NFAM NE '';

    PN=EPN_NFAM;
    EPN_SP=EPN_FAM;
    KEEP HHID PN EPN_SP ESUBHH;

    *   COPY PARENT-IN-LAW VARIABLES TO OUTPUT VARIABLES LOCATIONS;
    E1557_1=E1557_2;
    E1566_1=E1566_2A;
    KEEP E1557_1 E1566_1;
RUN;

*   Step 3:  Concatenate two parent files;
DATA PARENTS;
    SET FAMR NFAMR;
RUN;

PROC SORT DATA=PARENTS;
    BY HHID PN;
RUN;
Top


Respondent Record with Mother and Father Variables: 1994

*   REFORMAT PARENTS FILE TO ONE PER RESPONDENT;
*   STEP 1: SORT W2PARS FILE;
PROC SORT DATA=IN.W2PARS OUT=W2PARS;
    BY HHID PN CSUBHH;
RUN;

*   STEP 2: CREATE FILE WITH MOTHER RECORDS;
DATA MOM;
    SET W2PARS;
    WHERE CPARCODE IN ('1');

    KEEP HHID PN CSUBHH ASUBHH CPN_SP COPN_CS CCSR CFAMR CFINR RPN FAMFLAG
    W8201-W8211 W8213-W8219;

    RENAME
    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
    ;
RUN;

*   STEP 3: CREATE FILE WITH FATHER RECORDS;
DATA DAD;
    SET W2PARS;
    IF CPARCODE IN ('2');

    KEEP HHID PN CSUBHH ASUBHH CPN_SP COPN_CS CCSR CFAMR CFINR RPN FAMFLAG
    W8201-W8211 W8213-W8219;

    RENAME
    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
    ;
RUN;

*   STEP 4: CREATE FILE WITH PARENT RECORDS;
DATA PARENT;
    SET W2PARS;
    WHERE CPARCODE IN ('3');

    KEEP HHID PN CSUBHH ASUBHH CPN_SP COPN_CS CCSR CFAMR CFINR RPN FAMFLAG
    W8209-W8219 ;

    RENAME
    W8209    = W8209P
    W8210    = W8210P
    W8211    = W8211P
    W8212    = W8212P
    W8213    = W8213P
    W8214    = W8214P
    W8215    = W8215P
    W8216    = W8216P
    W8217    = W8217P
    W8218    = W8218P
    W8219    = W8219P
    ;
RUN;

*   STEP 5: MERGE MOTHER FATHER AND PARENT FILES;
DATA PARENTS;
    MERGE MOM(in=a) DAD(in=b) PARENT(in=c);
    BY HHID PN CSUBHH;
RUN;
Top


Respondent Record with Mother and Father Variables: 1992

*   REFORMAT PARENTS FILE FROM ONE PER PARENT TO ONE PER RESPONDENT;
*   STEP 1: SORT PARENTSW FILE;
PROC SORT DATA=IN.PARENTS OUT=PARENT1;
    BY HHID PN;
RUN;

*   STEP 2: CREATE FILE WITH MOTHER RECORDS;
DATA MOTHERS;
    SET PARENT1;
    WHERE ATYPEPAR EQ '1';

    KEEP HHID PN ASUBHH APN_SP AFAMR AFINR V1 V2 V3
    V8201-V8224 V18205-V18211 V18213-V18224;

    RENAME
    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
    ;
RUN;

*   STEP 3: CREATE FILE WITH FATHER RECORDS;
DATA FATHERS;
    SET PARENT1;
    WHERE ATYPEPAR EQ '2';

    KEEP HHID PN ASUBHH APN_SP AFAMR AFINR V1 V2 V3
    V8201-V8224 V18205-V18211 V18213-V18224;

    RENAME
    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
    ;
RUN;

*   STEP 4: MERGE MOTHER AND FATHER FILES;
DATA PARENTS;
    MERGE MOTHERS FATHERS;
    BY HHID PN;
RUN;
Top

Copyright © 2014 The Regents of the University of Michigan