Relationship to Household Parent Figures (Rounds 7-9 Childhood Retrospective) - Appendix 3

Relationship to Household Parent Figures (Rounds 7-9 Childhood Retrospective) - Appendix 3

Variables Created

  • CVC_YTH_REL_HH_AGE2_YCHR
  • CVC_YTH_REL_HH_AGE6_YCHR
  • CVC_YTH_REL_HH_AGE12_YCHR

This program creates variables indicating the relationship of the youth to the primary adults in the household when the youth was age 2, 6, and 12. Note that this program uses data from a special "Childhood Retrospective" section included in rounds 7-9. This section, which attempted to retrieve some of the information that would have been collected in the parent questionnaire, was administered once to each respondent interviewed in any of those three rounds who did not have a round 1 parent interview. A small number of respondents with a parent interview also went through this section as a control group, so some respondents will have data for both sets of Household Parent Figure variables, but most will not.

Variables Used

/*Variable Names in Program       Variable Names in Gator*/

Pubid                             PUBID
YCHR_102_2005                     YCHR-102
YCHR_120BA_01_2005                YCHR-120BA.01
YCHR_120CA_02_2005                YCHR-120CA.02
YCHR_120DA_03_2005                YCHR-120DA.03
YCHR_120EA_04_2005                YCHR-120EA.04
YCHR_120FA_05_2005                YCHR-120FA.05
YCHR_120GA_06_2005                YCHR-120GA.06
YCHR_120HA_07_2005                YCHR-120HA.07
YCHR_120IA_08_2005                YCHR-120IA.08
YCHR_120JA_09_2005                YCHR-120JA.09
YCHR_120KA_10_2005                YCHR-120KA.10
YCHR_120LA_11_2005                YCHR-120LA.11
YCHR_150_000001_2005              YCHR-150~000001
YCHR_150_000002_2005              YCHR-150~000002
YCHR_150_000003_2005              YCHR-150~000003
YCHR_150_000004_2005              YCHR-150~000004
YCHR_150_000005_2005              YCHR-150~000005
YCHR_150_000006_2005              YCHR-150~000006
YCHR_150_000007_2005              YCHR-150~000007
YCHR_150_000008_2005              YCHR-150~000008
YCHR_150_000009_2005              YCHR-150~000009
YCHR_150_000010_2005              YCHR-150~000010
YCHR_150_000011_2005              YCHR-150~000011
YCHR_190BA_01_2005                YCHR-190BA.01
YCHR_190CA_02_2005                YCHR-190CA.02
YCHR_190DA_03_2005                YCHR-190DA.03
YCHR_190EA_04_2005                YCHR-190EA.04
YCHR_190FA_05_2005                YCHR-190FA.05
YCHR_190GA_06_2005                YCHR-190GA.06
YCHR_190HA_07_2005                YCHR-190HA.07
YCHR_190IA_08_2005                YCHR-190IA.08
YCHR_190JA_09_2005                YCHR-190JA.09
YCHR_190KA_10_2005                YCHR-190KA.10
YCHR_190LA_11_2005                YCHR-190LA.11
YCHR_300                          YCHR-300
YCHR_400                          YCHR-400
YCHR_410                          YCHR-410
YCHR_450                          YCHR-450
YCHR_480_000001_2005              YCHR-480~000001
YCHR_480_000002_2005              YCHR-480~000002
YCHR_480_000003_2005              YCHR-480~000003
YCHR_480_000004_2005              YCHR-480~000004
YCHR_480_000005_2005              YCHR-480~000005
YCHR_480_000006_2005              YCHR-480~000006
YCHR_480_000007_2005              YCHR-480~000007
YCHR_480_000008_2005              YCHR-480~000008
YCHR_480_000009_2005              YCHR-480~000009
YCHR_480_000010_2005              YCHR-480~000010
YCHR_480_000011_2005              YCHR-480~000011
YCHR_510BA_01_2005                YCHR-510BA.01
YCHR_510CA_02_2005                YCHR-510CA.02
YCHR_510DA_03_2005                YCHR-510DA.03
YCHR_510EA_04_2005                YCHR-510EA.04
YCHR_510FA_05_2005                YCHR-510FA.05
YCHR_510GA_06_2005                YCHR-510GA.06
YCHR_510HA_07_2005                YCHR-510HA.07
YCHR_510IA_08_2005                YCHR-510IA.08
YCHR_510JA_09_2005                YCHR-510JA.09
YCHR_510KA_10_2005                YCHR-510KA.10
YCHR_510LA_11_2005                YCHR-510LA.11
YCHR_520_000001_2005              YCHR-520~000001
YCHR_520_000002_2005              YCHR-520~000002
YCHR_520_000003_2005              YCHR-520~000003
YCHR_520_000004_2005              YCHR-520~000004
YCHR_520_000005_2005              YCHR-520~000005
YCHR_520_000006_2005              YCHR-520~000006
YCHR_520_000007_2005              YCHR-520~000007
YCHR_520_000008_2005              YCHR-520~000008
YCHR_520_000009_2005              YCHR-520~000009
YCHR_520_000010_2005              YCHR-520~000010
YCHR_520_000011_2005              YCHR-520~000011
YCHR_565_01_2005                  YCHR-565.01
YCHR_565_02_2005                  YCHR-565.02
YCHR_565_03_2005                  YCHR-565.03
YCHR_565_04_2005                  YCHR-565.04
YCHR_565A_01_2005                 YCHR-565A.01
YCHR_565A_02_2005                 YCHR-565A.02
YCHR_565A_03_2005                 YCHR-565A.03
YCHR_565A_04_2005                 YCHR-565A.04
YCHR_575_01_2005                  YCHR-575.01
YCHR_575_02_2005                  YCHR-575.02
YCHR_575_03_2005                  YCHR-575.03
YCHR_575_04_2005                  YCHR-575.04
YCHR_580_01_000001_2005           YCHR-580.01~000001
YCHR_580_01_000002_2005           YCHR-580.01~000002
YCHR_580_01_000003_2005           YCHR-580.01~000003
YCHR_580_01_000004_2005           YCHR-580.01~000004
YCHR_580_01_000005_2005           YCHR-580.01~000005
YCHR_580_01_000006_2005           YCHR-580.01~000006
YCHR_580_01_000007_2005           YCHR-580.01~000007
YCHR_580_01_000008_2005           YCHR-580.01~000008
YCHR_580_01_000009_2005           YCHR-580.01~000009
YCHR_580_01_000010_2005           YCHR-580.01~000010
YCHR_580_01_000011_2005           YCHR-580.01~000011
YCHR_580_02_000001_2005           YCHR-580.02~000001
YCHR_580_02_000002_2005           YCHR-580.02~000002
YCHR_580_02_000003_2005           YCHR-580.02~000003
YCHR_580_02_000004_2005           YCHR-580.02~000004
YCHR_580_02_000005_2005           YCHR-580.02~000005
YCHR_580_02_000006_2005           YCHR-580.02~000006
YCHR_580_02_000007_2005           YCHR-580.02~000007
YCHR_580_02_000008_2005           YCHR-580.02~000008
YCHR_580_02_000009_2005           YCHR-580.02~000009
YCHR_580_02_000010_2005           YCHR-580.02~000010
YCHR_580_02_000011_2005           YCHR-580.02~000011
YCHR_580_03_000001_2005           YCHR-580.03~000001
YCHR_580_03_000002_2005           YCHR-580.03~000002
YCHR_580_03_000003_2005           YCHR-580.03~000003
YCHR_580_03_000004_2005           YCHR-580.03~000004
YCHR_580_03_000005_2005           YCHR-580.03~000005
YCHR_580_03_000006_2005           YCHR-580.03~000006
YCHR_580_03_000007_2005           YCHR-580.03~000007
YCHR_580_03_000008_2005           YCHR-580.03~000008
YCHR_580_03_000009_2005           YCHR-580.03~000009
YCHR_580_03_000010_2005           YCHR-580.03~000010
YCHR_580_03_000011_2005           YCHR-580.03~000011
YCHR_580_04_000001_2005           YCHR-580.04~000001
YCHR_580_04_000002_2005           YCHR-580.04~000002
YCHR_580_04_000003_2005           YCHR-580.04~000003
YCHR_580_04_000004_2005           YCHR-580.04~000004
YCHR_580_04_000005_2005           YCHR-580.04~000005
YCHR_580_04_000006_2005           YCHR-580.04~000006
YCHR_580_04_000007_2005           YCHR-580.04~000007
YCHR_580_04_000008_2005           YCHR-580.04~000008
YCHR_580_04_000009_2005           YCHR-580.04~000009
YCHR_580_04_000010_2005           YCHR-580.04~000010
YCHR_580_04_000011_2005           YCHR-580.04~000011
YCHR_582_01_2005                  YCHR-582.01
YCHR_582_02_2005                  YCHR-582.02
YCHR_582_03_2005                  YCHR-582.03
YCHR_582_04_2005                  YCHR-582.04
YCHR_583BA_01_01_2005             YCHR-583BA.01.01
YCHR_583BA_02_01_2005             YCHR-583BA.02.01
YCHR_583BA_03_01_2005             YCHR-583BA.03.01
YCHR_583BA_04_01_2005             YCHR-583BA.04.01
YCHR_583CA_01_02_2005             YCHR-583CA.01.02
YCHR_583CA_02_02_2005             YCHR-583CA.02.02
YCHR_583CA_03_02_2005             YCHR-583CA.03.02
YCHR_583CA_04_02_2005             YCHR-583CA.04.02
YCHR_583DA_01_03_2005             YCHR-583DA.01.03
YCHR_583DA_02_03_2005             YCHR-583DA.02.03
YCHR_583DA_03_03_2005             YCHR-583DA.03.03
YCHR_583DA_04_03_2005             YCHR-583DA.04.03
YCHR_583EA_01_04_2005             YCHR-583EA.01.04
YCHR_583EA_02_04_2005             YCHR-583EA.02.04
YCHR_583EA_03_04_2005             YCHR-583EA.03.04
YCHR_583EA_04_04_2005             YCHR-583EA.04.04
YCHR_583FA_01_05_2005             YCHR-583FA.01.05
YCHR_583FA_02_05_2005             YCHR-583FA.02.05
YCHR_583FA_03_05_2005             YCHR-583FA.03.05
YCHR_583FA_04_05_2005             YCHR-583FA.04.05
YCHR_583GA_01_06_2005             YCHR-583GA.01.06
YCHR_583GA_02_06_2005             YCHR-583GA.02.06
YCHR_583GA_03_06_2005             YCHR-583GA.03.06
YCHR_583GA_04_06_2005             YCHR-583GA.04.06
YCHR_583HA_01_07_2005             YCHR-583HA.01.07
YCHR_583HA_02_07_2005             YCHR-583HA.02.07
YCHR_583HA_03_07_2005             YCHR-583HA.03.07
YCHR_583HA_04_07_2005             YCHR-583HA.04.07
YCHR_583IA_01_08_2005             YCHR-583IA.01.08
YCHR_583IA_02_08_2005             YCHR-583IA.02.08
YCHR_583IA_03_08_2005             YCHR-583IA.03.08
YCHR_583IA_04_08_2005             YCHR-583IA.04.08
YCHR_583JA_01_09_2005             YCHR-583JA.01.09
YCHR_583JA_02_09_2005             YCHR-583JA.02.09
YCHR_583JA_03_09_2005             YCHR-583JA.03.09
YCHR_583JA_04_09_2005             YCHR-583JA.04.09
YCHR_583KA_01_10_2005             YCHR-583KA.01.10
YCHR_583KA_02_10_2005             YCHR-583KA.02.10
YCHR_583KA_03_10_2005             YCHR-583KA.03.10
YCHR_583KA_04_10_2005             YCHR-583KA.04.10
YCHR_583LA_01_11_2005             YCHR-583LA.01.11
YCHR_583LA_02_11_2005             YCHR-583LA.02.11
YCHR_583LA_03_11_2005             YCHR-583LA.03.11
YCHR_583LA_04_11_2005             YCHR-583LA.04.11
YCHR_584_01_2005                  YCHR-584.01
YCHR_584_02_2005                  YCHR-584.02
YCHR_584_03_2005                  YCHR-584.03
YCHR_584_04_2005                  YCHR-584.04
YCHR_586_01_2005                  YCHR-586.01
YCHR_586_02_2005                  YCHR-586.02
YCHR_586_03_2005                  YCHR-586.03
YCHR_586_04_2005                  YCHR-586.04
YCHR_589_01_2005                  YCHR-589.01
YCHR_589A_02_2005                 YCHR-589A.02
YCHR_589A_03_2005                 YCHR-589A.03
YCHR_589A_04_2005                 YCHR-589A.04
YCHR_589AALT_02_2005              YCHR-589AALT.02
YCHR_589AALT_03_2005              YCHR-589AALT.03
YCHR_589AALT_04_2005              YCHR-589AALT.04
YCHR_589ALT_01_2005               YCHR-589ALT.01
YCHR_590_01_2005                  YCHR-590.01
YCHR_590_02_2005                  YCHR-590.02
YCHR_590_03_2005                  YCHR-590.03
YCHR_590_04_2005                  YCHR-590.04
YCHR_590ALT_01_2005               YCHR-590ALT.01
YCHR_590ALT_02_2005               YCHR-590ALT.02
YCHR_590ALT_03_2005               YCHR-590ALT.03
YCHR_590ALT_04_2005               YCHR-590ALT.04
YCHR_594_01_2005                  YCHR-594.01
YCHR_594A_02_2005                 YCHR-594A.02
YCHR_594A_03_2005                 YCHR-594A.03
YCHR_594A_04_2005                 YCHR-594A.04
YCHR_594AALT_02_2005              YCHR-594AALT.02
YCHR_594AALT_03_2005              YCHR-594AALT.03
YCHR_594AALT_04_2005              YCHR-594AALT.04
YCHR_594ALT_01_2005               YCHR-594ALT.01
YCHR_595_01_2005                  YCHR-595.01
YCHR_595_02_2005                  YCHR-595.02
YCHR_595_03_2005                  YCHR-595.03
YCHR_595_04_2005                  YCHR-595.04
YCHR_595ALT_01_2005               YCHR-595ALT.01
YCHR_595ALT_02_2005               YCHR-595ALT.02
YCHR_595ALT_03_2005               YCHR-595ALT.03
YCHR_595ALT_04_2005               YCHR-595ALT.04
YCHR_599_01_2005                  YCHR-599.01
YCHR_599A_02_2005                 YCHR-599A.02
YCHR_599A_03_2005                 YCHR-599A.03
YCHR_599A_04_2005                 YCHR-599A.04
YCHR_599AALT_02_2005              YCHR-599AALT.02
YCHR_599AALT_03_2005              YCHR-599AALT.03
YCHR_599AALT_04_2005              YCHR-599AALT.04
YCHR_599ALT_01_2005               YCHR-599ALT.01
YCHR_600_01_2005                  YCHR-600.01
YCHR_600_02_2005                  YCHR-600.02
YCHR_600_03_2005                  YCHR-600.03
YCHR_600_04_2005                  YCHR-600.04
YCHR_600ALT_01_2005               YCHR-600ALT.01
YCHR_600ALT_02_2005               YCHR-600ALT.02
YCHR_600ALT_03_2005               YCHR-600ALT.03
YCHR_600ALT_04_2005               YCHR-600ALT.04
YCHR_604_01_2005                  YCHR-604.01
YCHR_604A_02_2005                 YCHR-604A.02
YCHR_604A_03_2005                 YCHR-604A.03
YCHR_604A_04_2005                 YCHR-604A.04
YCHR_604AALT_02_2005              YCHR-604AALT.02
YCHR_604AALT_03_2005              YCHR-604AALT.03
YCHR_604AALT_04_2005              YCHR-604AALT.04
YCHR_604ALT_01_2005               YCHR-604ALT.01
YCHR_605_01_2005                  YCHR-605.01
YCHR_605_02_2005                  YCHR-605.02
YCHR_605_03_2005                  YCHR-605.03
YCHR_605_04_2005                  YCHR-605.04
YCHR_605ALT_01_2005               YCHR-605ALT.01
YCHR_605ALT_02_2005               YCHR-605ALT.02
YCHR_605ALT_03_2005               YCHR-605ALT.03
YCHR_605ALT_04_2005               YCHR-605ALT.04

SAS Code for Variable Creation

/* Initialize R9 value to cv of R8.*/
data merge2005; merge ychr.kp2005 ychr8.work2004_clps(keep=pubid arelr8:); by pubid;
array arelr8(3) arelr8_2   arelr8_6   arelr8_12 ;
array arelr9(3) arelr9_2   arelr9_6   arelr9_12 ;
/* Initialize R9 value to cv of R8.*/
do i = 1 to 3;
    arelr9(i)=arelr8(i);
end;   


/* If R never went into the section of YCHR questions, assign their value accordingly*/
data ni2005; set merge2005;  if YCHR_102_2005 in (-5,-4);

/* If R went through the section*/
data i2005; set merge2005; if YCHR_102_2005>-4;

/********************************************** PART I ***********************************************/
/*  Define all the arrays used in this program                                                        */
/******************************************************************************************************/

/* (1) Created Variables:
    Rs relationship to household parent figure at age 2, 6, 12 */
array arelr9(3) arelr9_2   arelr9_6   arelr9_12 ;
                              
/* (2) (Raw data) Information available from current round.; */
/* variable dummy for parent figure */
array parent (14, 11)                  
YCHR_120BA_01_2005  YCHR_120CA_02_2005  /* bio mom, dad */
YCHR_120DA_03_2005  YCHR_120EA_04_2005  /* adopt mom, dad */
YCHR_120FA_05_2005  YCHR_120GA_06_2005  /* step mom, dad */
YCHR_120HA_07_2005  YCHR_120IA_08_2005  /* grand mom, dad */
YCHR_120JA_09_2005  YCHR_120KA_10_2005  /* foster mom, dad */
YCHR_120LA_11_2005                      /* no parent figure */
    /* these are current situation "as of R1", we initialize the relationship according to these 120 dummies.
    These machine check dummies are just the same as
    created variable on "living status at R1", not really new information.*/

YCHR_150_000001_2005  YCHR_150_000002_2005  /* bio mom, dad */
YCHR_150_000003_2005  YCHR_150_000004_2005  /* adopt mom, dad */
YCHR_150_000005_2005  YCHR_150_000006_2005  /* step mom, dad */
YCHR_150_000007_2005  YCHR_150_000008_2005  /* grand mom, dad */
YCHR_150_000009_2005  YCHR_150_000010_2005  /* foster mom, dad */
YCHR_150_000011_2005                        /* no parent figure */
    /* if R volunteer for a correction of recorded living situation at DOFI,
    R would went into ychr-150: questions for parent figures  */

YCHR_190BA_01_2005  YCHR_190CA_02_2005  /* bio mom, dad */
YCHR_190DA_03_2005  YCHR_190EA_04_2005  /* adopt mom, dad */
YCHR_190FA_05_2005  YCHR_190GA_06_2005  /* step mom, dad */
YCHR_190HA_07_2005  YCHR_190IA_08_2005  /* grand mom, dad */
YCHR_190JA_09_2005  YCHR_190KA_10_2005  /* foster mom, dad */
YCHR_190LA_11_2005                      /* no parent figure */
    /* actually ychr-190 in r9 only listed to ychr-190HA, but we keep the rest dummy
    variables for completeness of this program.
    These machine check dummies came after the ychr-150: questions.
    They are the same thing, not really new information.
    */
    
YCHR_480_000001_2005  YCHR_480_000002_2005  /* bio mom, dad */
YCHR_480_000003_2005  YCHR_480_000004_2005  /* adopt mom, dad */
YCHR_480_000005_2005  YCHR_480_000006_2005  /* step mom, dad */
YCHR_480_000007_2005  YCHR_480_000008_2005  /* grand mom, dad */
YCHR_480_000009_2005  YCHR_480_000010_2005  /* foster mom, dad */
YCHR_480_000011_2005                        /* no parent figure */
    /* these are "after birth living situation" dummies-- R went through
    these if R didn't answere 'yes' to     ychr-450 question
    ("was living with both parents after birth?") */

YCHR_520_000001_2005  YCHR_520_000002_2005  /* bio mom, dad */
YCHR_520_000003_2005  YCHR_520_000004_2005  /* adopt mom, dad */
YCHR_520_000005_2005  YCHR_520_000006_2005  /* step mom, dad */
YCHR_520_000007_2005  YCHR_520_000008_2005  /* grand mom, dad */
YCHR_520_000009_2005  YCHR_520_000010_2005  /* foster mom, dad */
YCHR_520_000011_2005                        /* no parent figure */
    /* these are "earliest point situation"  dummies-- R went through these  
    if R answered '-1,-2' to ychr-450
    ("was living with both parents after birth?")
    R answered ychr_480 or ychr_520 would then go to ychr-530
    ("what is your age at this first living situation?") */

YCHR_510BA_01_2005  YCHR_510CA_02_2005  /* bio mom, dad */
YCHR_510DA_03_2005  YCHR_510EA_04_2005  /* adopt mom, dad */
YCHR_510FA_05_2005  YCHR_510GA_06_2005  /* step mom, dad */
YCHR_510HA_07_2005  YCHR_510IA_08_2005  /* grand mom, dad */
YCHR_510JA_09_2005  YCHR_510KA_10_2005  /* foster mom, dad */
YCHR_510LA_11_2005                      /* no parent figure */
    /* These machine check dummies came after these questions:
    ychr-450, ("live with both bio after birth?"),  
    ychr-530, ("age of first living situation").
    and a bunch of questions checking where parents are at R's birth.
    They are the same information from ychr-480 and ychr-520. */

    
YCHR_580_01_000001_2005  YCHR_580_01_000002_2005 /* bio mom, dad */
YCHR_580_01_000003_2005  YCHR_580_01_000004_2005 /* adopt mom, dad */
YCHR_580_01_000005_2005  YCHR_580_01_000006_2005 /* step mom, dad */
YCHR_580_01_000007_2005  YCHR_580_01_000008_2005 /* grand mom, dad */
YCHR_580_01_000009_2005  YCHR_580_01_000010_2005 /* foster mom, dad */
YCHR_580_01_000011_2005                          /* no parent figure */
                
    
ychr_580_02_000001_2005  ychr_580_02_000002_2005 /* bio mom, dad */
ychr_580_02_000003_2005  ychr_580_02_000004_2005 /* adopt mom, dad */
ychr_580_02_000005_2005  ychr_580_02_000006_2005 /* step mom, dad */
ychr_580_02_000007_2005  ychr_580_02_000008_2005 /* grand mom, dad */
ychr_580_02_000009_2005  ychr_580_02_000010_2005 /* foster mom, dad */
ychr_580_02_000011_2005                          /* no parent figure */
                
    
ychr_580_03_000001_2005  ychr_580_03_000002_2005 /* bio mom, dad */
ychr_580_03_000003_2005  ychr_580_03_000004_2005 /* adopt mom, dad */
ychr_580_03_000005_2005  ychr_580_03_000006_2005 /* step mom, dad */
ychr_580_03_000007_2005  ychr_580_03_000008_2005 /* grand mom, dad */
ychr_580_03_000009_2005  ychr_580_03_000010_2005 /* foster mom, dad */
ychr_580_03_000011_2005                          /* no parent figure */
                
    
ychr_580_04_000001_2005  ychr_580_04_000002_2005 /* bio mom, dad */
ychr_580_04_000003_2005  ychr_580_04_000004_2005 /* adopt mom, dad */
ychr_580_04_000005_2005  ychr_580_04_000006_2005 /* step mom, dad */
ychr_580_04_000007_2005  ychr_580_04_000008_2005 /* grand mom, dad */
ychr_580_04_000009_2005  ychr_580_04_000010_2005 /* foster mom, dad */
ychr_580_04_000011_2005                          /* no parent figure */

YCHR_583BA_01_01_2005  YCHR_583CA_01_02_2005  /* bio mom, dad */
YCHR_583DA_01_03_2005  YCHR_583EA_01_04_2005  /* adopt mom, dad */
YCHR_583FA_01_05_2005  YCHR_583GA_01_06_2005  /* step mom, dad */
YCHR_583HA_01_07_2005  YCHR_583IA_01_08_2005  /* grand mom, dad */
YCHR_583JA_01_09_2005  YCHR_583KA_01_10_2005  /* foster mom, dad */
YCHR_583LA_01_11_2005                         /* no parent figure */

YCHR_583BA_02_01_2005  YCHR_583CA_02_02_2005  /* bio mom, dad */
YCHR_583DA_02_03_2005  YCHR_583EA_02_04_2005  /* adopt mom, dad */
YCHR_583FA_02_05_2005  YCHR_583GA_02_06_2005  /* step mom, dad */
YCHR_583HA_02_07_2005  YCHR_583IA_02_08_2005  /* grand mom, dad */
YCHR_583JA_02_09_2005  YCHR_583KA_02_10_2005  /* foster mom, dad */
YCHR_583LA_02_11_2005                         /* no parent figure */

YCHR_583BA_03_01_2005  YCHR_583CA_03_02_2005  /* bio mom, dad */
YCHR_583DA_03_03_2005  YCHR_583EA_03_04_2005  /* adopt mom, dad */
YCHR_583FA_03_05_2005  YCHR_583GA_03_06_2005  /* step mom, dad */
YCHR_583HA_03_07_2005  YCHR_583IA_03_08_2005  /* grand mom, dad */
YCHR_583JA_03_09_2005  YCHR_583KA_03_10_2005  /* foster mom, dad */
YCHR_583LA_03_11_2005                         /* no parent figure */

YCHR_583BA_04_01_2005  YCHR_583CA_04_02_2005  /* bio mom, dad */
YCHR_583DA_04_03_2005  YCHR_583EA_04_04_2005  /* adopt mom, dad */
YCHR_583FA_04_05_2005  YCHR_583GA_04_06_2005  /* step mom, dad */
YCHR_583HA_04_07_2005  YCHR_583IA_04_08_2005  /* grand mom, dad */
YCHR_583JA_04_09_2005  YCHR_583KA_04_10_2005  /* foster mom, dad */
YCHR_583LA_04_11_2005                         /* no parent figure */ ;
    /* Dummy for parent figure after each living situation change loop.
    After arrays of machine check dummies, would then go to questions
    "how bio/adopt mom/dad shift before and after the change", "why change".*/
                                                                
array parent2(14,3)
parent2lp1_1  parent2lp1_2  parent2lp1_3   /* dummy for ychr-120 loops*/
parent2lp2_1  parent2lp2_2  parent2lp2_3   /* dummy for ychr-150 loops*/
parent2lp3_1  parent2lp3_2  parent2lp3_3   /* dummy for ychr-190 loops*/
parent2lp4_1  parent2lp4_2  parent2lp4_3   /* dummy for ychr-480 loops*/
parent2lp5_1  parent2lp5_2  parent2lp5_3   /* dummy for ychr-520 loops*/
parent2lp6_1  parent2lp6_2  parent2lp6_3   /* dummy for ychr-510 loops*/

YCHR_582_01_2005      /* DID R LIVE WITH PARENT FIGURE? L1 2004 ychr_580_01 */
YCHR_584_01_2005      /* RELATIONSHIP OF R'S PARENT FIGURE L1 2004 */
YCHR_586_01_2005       /* DESCRIPTION OF THE PLACE R LIVED L1 2004 */                        

YCHR_582_02_2005      /* DID R LIVE WITH PARENT FIGURE? L2 2004 ychr_580_02 */
YCHR_584_02_2005    /* RELATIONSHIP OF R'S PARENT FIGURE L2 2004 */
YCHR_586_02_2005       /* DESCRIPTION OF THE PLACE R LIVED L2 2004 */                                    
                   
YCHR_582_03_2005      /* DID R LIVE WITH PARENT FIGURE? L3 2004 ychr_580_03 */
YCHR_584_03_2005    /* RELATIONSHIP OF R'S PARENT FIGURE L3 2004 */
YCHR_586_03_2005       /* DESCRIPTION OF THE PLACE R LIVED L3 2004 */                                    
                   
YCHR_582_04_2005      /* DID R LIVE WITH PARENT FIGURE? L4 2004 ychr_580_04 */
YCHR_584_04_2005    /* RELATIONSHIP OF R'S PARENT FIGURE L4 2004 */
YCHR_586_04_2005       /* DESCRIPTION OF THE PLACE R LIVED L4 2004 */                                    
                   
parent2lp11_1 parent2lp11_2 parent2lp11_3  /* dummy for ychr-583_1 loops*/
parent2lp12_1 parent2lp12_2 parent2lp12_3  /* dummy for ychr-583_2 loops*/
parent2lp13_1 parent2lp13_2 parent2lp13_3  /* dummy for ychr-583_3 loops*/
parent2lp14_1 parent2lp14_2 parent2lp14_3  /* dummy for ychr-583_4 loops*/  ;            
                                    

                        

array b3 (4,16)
    /* First loop, imilar to the first loop above. */
YCHR_589_01_2005  YCHR_590_01_2005  YCHR_589ALT_01_2005   YCHR_590ALT_01_2005
YCHR_594_01_2005  YCHR_595_01_2005  YCHR_594ALT_01_2005   YCHR_595ALT_01_2005
YCHR_599_01_2005  YCHR_600_01_2005  YCHR_599ALT_01_2005   YCHR_600ALT_01_2005
YCHR_604_01_2005  YCHR_605_01_2005  YCHR_604ALT_01_2005   YCHR_605ALT_01_2005    
 
    /* Second loop, imilar to the first loop above. */
YCHR_589A_02_2005  YCHR_590_02_2005  YCHR_589AALT_02_2005 YCHR_590ALT_02_2005
YCHR_594A_02_2005  YCHR_595_02_2005     YCHR_594AALT_02_2005 YCHR_595ALT_02_2005
YCHR_599A_02_2005  YCHR_600_02_2005  YCHR_599AALT_02_2005 YCHR_600ALT_02_2005
YCHR_604A_02_2005  YCHR_605_02_2005  YCHR_604AALT_02_2005 YCHR_605ALT_02_2005   
    
    /* Third loop, imilar to the first loop above. */
YCHR_589A_03_2005  YCHR_590_03_2005 YCHR_589AALT_03_2005 YCHR_590ALT_03_2005
YCHR_594A_03_2005  YCHR_595_03_2005 YCHR_594AALT_03_2005 YCHR_595ALT_03_2005
YCHR_599A_03_2005  YCHR_600_03_2005 YCHR_599AALT_03_2005 YCHR_600ALT_03_2005
YCHR_604A_03_2005  YCHR_605_03_2005 YCHR_604AALT_03_2005 YCHR_605ALT_03_2005      
   
    /* Four loop, imilar to the first loop above. */
YCHR_589A_04_2005  YCHR_590_04_2005 YCHR_589AALT_04_2005 YCHR_590ALT_04_2005   
YCHR_594A_04_2005  YCHR_595_04_2005 YCHR_594AALT_04_2005 YCHR_595ALT_04_2005
YCHR_599A_04_2005  YCHR_600_04_2005 YCHR_599AALT_04_2005 YCHR_600ALT_04_2005
YCHR_604A_04_2005  YCHR_605_04_2005 YCHR_604AALT_04_2005 YCHR_605ALT_04_2005 ;     

    /* arrays on age of changing living situations */    
array b2(4,3)
YCHR_565_01_2005    YCHR_565A_01_2005    YCHR_575_01_2005
YCHR_565_02_2005    YCHR_565A_02_2005    YCHR_575_02_2005
YCHR_565_03_2005    YCHR_565A_03_2005    YCHR_575_03_2005
YCHR_565_04_2005    YCHR_565A_04_2005    YCHR_575_04_2005 ;
                                                 
    

/* (3) Intermediate variables created based on information available from current round.; */

array cc(14) cc1-cc14;
    /* intermediate relationship created from 14 groups of dummy variables in parent(10,11)
    These 7 group involve machine checks:
    ychr_120 ychr_190 ychr_510 ychr_583_0(1~4).
    They result in cc1,cc3,cc6,cc11,cc12,cc13,cc14 variables respectively.
    cc1 (row 1) are machine checks for DOFI living situation
    cc3 (row 3) are machine checks for row 2,
    cc6 (row 6) are machine checks for row 4 or 5.
    cc11(row 11) are machine checks for row 7
    cc12(row 12) are machine checks for row 8
    cc13(row 13) are machine checks for row 9
    cc14(row 14) are machine checks for row 10. */

array age   (3) age_2  age_6  age_12 ;
    /* age array with value = 2,6,12 respectively */
    
array loopnum(3) loopnum_2 loopnum_6 loopnum_12       ;
    /* Decide which loop of living situation corresponds to age 2,6,12,
        by comparing the age of change to 2, 6, 12.
        The change immediately happened before age should be the relevant loop .*/

array ac(4) ac1-ac4;
    /* These are combined age of change from two sets of questions,
    the first set is ychr_565A_0: and the second is ychr_575_0:
    they are besically same questions but looped differently.
    No one answered both ychr_565A_01 & ychr_575_01 at the same time.
    Nor for loop 2,3,4.
    But there are people reported ychr_565A_01 ychr_565A_03 then ychr_575_02
    & ychr_575_04, so these needed to be combined into one array of age.*/
    
array noinfo(3) noinfo_2 noinfo_6 noinfo_12;
    /* This array is dummy for all reported age greater than cut off age. */

/* (4) Variables created for use in checking the created variables.; */
prb_parent          =. ; /* problem flag for: parent combination with questions */
prb_bkloop          =. ; /* problem flag for: back reporting age */
prb_ageconflict     =. ; /* problem flag for: ychr_565A and ychr_575 have conflict info on age    */
prb_twoadd             =. ; /* problem flag for: R goes through both loops of ychr_565A and ychr_575, combine these info*/
prb_nknowrefs         =. ; /* problem flag for: R report don't know or refuse in age of change*/
prb_sameinfo         =. ; /* problem flag for: R should have some info in answer and check dummies, if not then this flag*/
prb_wrongloop         =. ; /* problem flag for: if R is assigned one loop incorrectly in program calculation*/
prb_conflictinfo     =. ; /* problem flag for: if R has conflict info between answer and check dummies*/
prb_missinfo        =. ; /* problem flag for: if R was assigned one loop but the loop don't have living info*/

/*********************************************** PART II ***********************************************
***  Initialize the created variables to -4, then to ychr_120 dummies. Create date of birth, **
***  contunuous month when age is 2,6,12 in CMS schemes.                                                          **
*******************************************************************************************************/;
    /* Initialize the loop of change living situation and loop of living away to missing
    Don't have to set  arelr9(i)=-4; because we've initialized arelr9 value to arelr8.*/

do i = 1 to 3;
    loopnum(i)=.;
    noinfo(i)=0;
end;   

    /* Assign age number to age() array */
    
age_2=2;
age_6=6;
age_12=12;

/*******************************************************************************************************
***  identify the loop number into which age 2 (6,12) falls                                      **
**  if there are multiple changes in the age year then the loopnum takes the last one           **
*******************************************************************************************************/;

    /* Decide which loop should be assigned for age 2, 6, 12. */

/* Some went through both ychr_565A_0: and ychr_575_0:
check if one respondent went into both of the same loop resulting
a problem of conflicting answers on 'age of change'.
No case with conflicting answers.
Then check whether we should combine the two answers together.
There are 80 cases with 'age of change'>-4 in both ychr_565A_0: and ychr_575_0: */

do j= 1 to 4;
    if b2(j,2)>-4 then
    do k =1 to 4;
        if b2(k,3)>-4 then
        do;
            if k=j then prb_ageconflict=j;
            else if k~=j then prb_twoadd=3*1000+k*100+2*10+j;
        end;
        if 0<=b2(k,2)<b2(j,2) and k>j then prb_bkloop=10*2+k;
        if 0<=b2(k,3)<b2(j,3) and k>j then prb_bkloop=10*3+k;        
    end;    
    if -4< b2(j,1) <0 then prb_nknowrefs= 10*1+j;
    if -4< b2(j,2) <0 then prb_nknowrefs= 10*2+j;
    if -4< b2(j,3) <0 then prb_nknowrefs= 10*3+j;
end;

/* For those cases went through both age question sections: ychr_565A_0:
and ychr_575_0:, none have age conflicts. This section combines
these two into one Array ac(4). ("age of change")
If there are cases with conflicting ages, they will not be combined. */
if prb_ageconflict=. and prb_bkloop=. then
do j=1 to 4;
    if b2(j,2)>-4 and b2(j,3)<=-4 then ac(j)=b2(j,2);
    if b2(j,2)<=-4 and b2(j,3)>-4 then ac(j)=b2(j,3);
    if b2(j,2)<=-4 and b2(j,3)<=-4 and -4< b2(j,1) <0 then ac(j)=b2(j,1);
    do k=1 to j-1;
        if 0<=ac(j)<ac(k) then prb_bkloop=j;
    end;
end;

/* Confirmed on June 3rd 2009, back reporting cases are
    special to R7, survey design has fixed the loophole for R8, R9--
    from R8 on, the sequence of ages are bounded to be increasing,
    the answers would not have back reporting problems.
    There are 22 cases in R7 with back reporting age problems,
    (that is, 'age of living situation change' in a later loop is
    smaller than in an earlier loop.) Examining the pattern of these 22 cases,
    Respondents are confused, the ages back reported did not provide information
    on their actual path of changes.
    The solution for these 22 cases: treat the ages reported later as '-4'.
    For example, a sequence of "7->11->12->0", we treat it as a sequence of
    "7->11->12-> -4", then proceed as usual.     */

if prb_ageconflict=. and prb_bkloop~=. then
do j=1 to 4;
    if b2(j,2)<=-4 and b2(j,3)<=-4 and -4< b2(j,1) <0 then ac(j)=b2(j,1);
    if b2(j,2)>-4 and b2(j,3)<=-4 then ac(j)=b2(j,2);
    if b2(j,2)<=-4 and b2(j,3)>-4 then
    do;
        if 0<=b2(j,3)<= max(ac(1), ac(2),ac(3),ac(4)) then ac(j)=-4;
        /* treat the back reported second age loop*/
        if -4< b2(j,3)<0 then  ac(j)=b2(j,3);
    end;    
    do k=1 to j-1;
        if 0<=ac(j)<ac(k) then prb_bkloop=j;
    end;

end;

    
    /* Section for good data. Cases with prb_ageconflict, prb_nknowrefs,
    prb_bkloop flag that would be treated differently. See 'data with
    problems' following. */
    
    
if prb_ageconflict=. then
do k = 1 to 3; /* ychr_565A_0: and ychr_575_0: are combined into one ac(j) loops.*/
    do j = 1 to 4;
        if 0<=ac(j)<= age(k) then
        do ;
            if loopnum(k)=. then loopnum(k)=j;
            else if 1<=loopnum(k)<=4 then
            do;
                if ac(j)>= ac(loopnum(k))>=0 then loopnum(k)=j;
                else if 0<= ac(j) < ac(loopnum(k)) then prb_bkloop=j;
            end;
        end;
        else noinfo(k)=noinfo(k)+1;
    end;
    if noinfo(k) =4 and loopnum(k)=. then loopnum(k)=0;
end;
    
/* Data problem patterns:
1. If answered don't know / refuse to age ychr_565_0j -- b2(j,1)
    all age loops are -4;
2. If R went through age loops, but he has one don't know / refuse;
    assign loopnum don't know / refuse accordingly.  
3. Added May 26, 2009. The case R has last loop age
    don't know/refuse, but all other ages are later than cutting-off time,
    should not have assigned all don't know, refuse. In other words, we assume
    they reporting age in an increasing order(even though there are people back reporting.)
    For example, if R reported age of change as: 3 5 13 -1. Then we assume the 4th loop
    age is greater than 13, none of the 2,6,12 cutting off time would be changed by the
    -1 at the end of the sequence. */
    
if prb_nknowrefs~=. then
do;
    maxage    =max(of ac(1),ac(2),ac(3),ac(4) );  
    if maxage in (-1,-2,-3) then
    do k = 1 to 3;
        loopnum(k)=maxage;
    end;
    else if maxage <=-4 and round(prb_nknowrefs,10)=10 then
    do k = 1 to 3;
        loopnum(k)= -3 ;
    end;
      else if 0<=maxage then
    do k = 1 to 3;
        if 0<=loopnum(k)<=3 then
        do;
            if ac(loopnum(k)+1) in (-1,-2,-3) then loopnum(k)= ac(loopnum(k)+1);
        end;
    end;
    /* this comes from the assumption that ages are reported in an increasing order */
end;

/*******************************************************************************************************
**   assign the relationship with parent figure by the dummy questions accordingly.                 **
**   there are follow up questions on parent figure and living locations. ( some loops don't have   **
**   parent figure/living location questions, these are supplemented with dummies                    **
*******************************************************************************************************/;

do i = 1 to 14 ;  
    /* By parent figure dummies*/
   if parent(i,1)=1 then
   do;
        if parent(i,2)=1 then cc(i)=1; /*biomom+biodad */
        else if parent(i,3)=1 then
        do ;
            prb_parent=i*1000+2*100+2*10; /*biomom+adpmom */
            cc(i)=4;
        end;
        else if parent(i,4)=1 then
        do;
            prb_parent=i*1000+2*100+1*10; /*biomom+adpdad */
            cc(i)=2;
        end;
        else if parent(i,5)=1 then
        do;
            prb_parent=i*1000+2*100+2*1; /*biomom+stepmom */        
            cc(i)=4;
        end;
        else if parent(i,6)=1 then cc(i)=2;     /*biomom+stepdad */
        else cc(i)=4;
   end;
   if parent(i,1)=0 then
   do;  
        if parent(i,2)=1 then
        do;
            if parent(i,3)=1 then
            do;
                prb_parent=i*1000+1*100+2*10; /*biodad+adpmom */
                cc(i)=3;
            end;
            if parent(i,4)=1 then
            do;
                prb_parent=i*1000+1*100+1*10; /*biodad+adpdad */
                cc(i)=5;
            end;
            if parent(i,5)=1 then cc(i)=3; /*biodad+stepmom */
            if parent(i,6)=1 then
            do;
                prb_parent=i*1000+1*100+1*1;
                cc(i)=5; /*biodad+stepdad */
            end;
            else cc(i)=5;
        end;    
        if parent(i,2)=0 then
        do;
          if parent(i,3)=1 or parent(i,4)=1 then cc(i)=6;
          if cc(i)=. and (parent(i,9)=1 or parent(i,10)=1) then cc(i)=7;
          if cc(i)=. and (parent(i,5)=1 or parent(i,6)=1) then cc(i)=8;
          if cc(i)=. and (parent(i,7)=1 or parent(i,8)=1) then cc(i)=8;
          /* if parent(i,11)=1 ; then relation determined by follow-ups
          by the parent2() array. do nothing at this step*/
        end;
   end;
    /* followup parent figure relation & location*/    
    if cc(i)=. and parent2(i,1)=1 then
    do;
        /* relation to parent figure*/  
        if parent2(i,2)=3 then cc(i)=4;  
        else if parent2(i,2)=4 then cc(i)=5;
        else if parent2(i,2)=7 or parent2(i,2)=8 then cc(i)=8;
        else if parent2(i,2)=5 or parent2(i,2)=6 then cc(i)=6;
        else if parent2(i,2)=9 or parent2(i,2)=10 then cc(i)=7;
        else if (parent2(i,2) in (3,4,5,6,7,8,9,10) =0 )
        and (cc(i) in (1,2,3,4,5,6,7,9)=0) then cc(i)=8;                  
    end;                            
     /* living location*/       
    if parent2(i,3) in (2,3,4,5) then cc(i)=9;  
    else if parent2(i,3) in (1,6,7) and (cc(i) in (1,2,3,4,5,6,7,8,9)=0) then cc(i)=10;
end;  

/*******************************************************************************************************
*** linking these intermediate living situations to the living situation at age 2, 6, 12        **
**  according to the onset of living situation changes and other time/age answers.        **
*******************************************************************************************************/;

/* People reporting always living with both bio parents before DOFI have status
(of 2,6,12) being assigned to "living with both bio".
Those people then went out of the loop, they will not be asked living situation at
 "after birth, earliest point, 1st , 2nd , 3rd, 4th changes".
Check if those reported living with both bio parents in DOFI and have been always
living with both bio parents are consistent with their dummies.
-- Yes. There are 526 of them and they are consistent with the dummies.
So assign these 526 respondent their 2,6,12 living situation to always live with
both bio parents. May 4,2009. */

if YCHR_300_2005=1 and (YCHR_400_2005=1 or YCHR_410_2005=0) and (cc(1)=1 or cc(2)=1) then
do i =1 to 3;
    arelr9(i)=1;
end;    

/* check if the repeated dummy give results of living status that agree with each other.
Specifically, for a given individual, if:
 cc2==>cc3.
 cc4 or cc5==>cc6.
 cc7,8,9,10==>cc11,12,13,14.
 that look right.
 Otherwise, we need to check why the essentially same info differ.
 There are 1265 cases in check results that have different results from these flags.
 All these flags come from one dummy variable missing the other nonmissing.
 None come from conflicting answers.
*/

if cc2 ~= cc3 then prb_sameinfo= 2;
if cc4 ~= cc6 then prb_sameinfo= 4;
if cc5 ~= cc6 then prb_sameinfo= 5;
if cc7 ~= cc11 then prb_sameinfo=7;
if cc8 ~= cc12 then prb_sameinfo=8 ;
if cc9 ~= cc13 then prb_sameinfo=9 ;
if cc10~= cc14 then prb_sameinfo=10;
                              
/*  Check why some are missing in the pair of essentially the same info.
The great majority have same results in the same pair, for example in the pair of cc7~cc11,
there are 1021 cases agreeing, but 13 cases with one or the other part missing.
The missing side have all -4 dummies--> not mistakes in the step of assigning relation
codes according to dummies .  
If we collaspes the pair info onto one, missing on either sides is possible. */

/* check if loopnum of age are assigned correctly, like, if loopnum_2 loopnum for age 2
is assigned 3, but the age of loop 3 is 13, then this is wrong.
There is no wrongloop.  */

if prb_ageconflict=. and prb_nknowrefs=. then
do k = 1 to 3;
    /* No double answer cases, go through 2 age loops separately. */
    if prb_twoadd=. then  
    do pointer= 2,3 ;
        if loopnum(k)>0 and b2(loopnum(k),pointer)>age(k)
        then prb_wrongloop=10*pointer+k;
    end;
    else if prb_twoadd~=. then  
    do ;
        if loopnum(k)>0 and ac(loopnum(k))>age(k)     
        then prb_wrongloop=k;
    end;
end;    

 
 
    /* The loopnum resolve to 1~4 corresponds to cc7~cc10 or cc11~14. */
do k =1 to 3;
    if loopnum(k)>0 then
    do;
        if cc(loopnum(k)+6)>0 then
        do;
            if cc(loopnum(k)+10)=. or cc(loopnum(k)+10)=cc(loopnum(k)+6) then
            arelr9(k)=cc(loopnum(k)+6);
            else if cc(loopnum(k)+10)>0 and cc(loopnum(k)+10)~=cc(loopnum(k)+6) then
            prb_conflictinfo=loopnum(k)+6;
        end;
        else if cc(loopnum(k)+6)=. then
        do;
            if cc(loopnum(k)+10)>0 then arelr9(k)=cc(loopnum(k)+10);
            else if cc(loopnum(k)+10)=. then prb_missinfo=loopnum(k)+6;
        end;    
    end;
    else if loopnum(k)=0 then
    do;
        if cc(6)>0 then arelr9(k)=cc(6);
        else if cc(6)=. then
        do;
            if cc(4)>0 and cc(5)=. then arelr9(k)=cc(4);
            if cc(5)>0 and cc(4)=. then arelr9(k)=cc(5);
            if cc(4)>0 and cc(5)>0 and cc(4)~=cc(5) then prb_conflictinfo=4.5;
            if cc(4)=cc(5)=. then prb_missinfo=6;
        end;
    end;
    else if -4<loopnum(k)<0 then arelr9(k)=loopnum(k);
    /* any refuse, don't know happened for the age of living situation
    will result the relation being assigned refuse, don't know accordingly,
    as we don't know if the (-2,-1) will be smaller than the age.
    Since back reporting age is possible of all these loops.*/
end;
 

/*******************************************************************************************************
*** convert (-1,-2,-3) to -3   **
*******************************************************************************************************/
do i = 1 to 3;
    if arelr9(i) in (-1,-2,-3) then arelr9(i)=-3;
end;