Appendix 1: Education Variable Creation

Return to Table of Contents


Enrollment Status, Highest Grade Completed, and Highest Degree Received

Variables Created:

Variables Used

Name in Program Question Name in Data   Name in Program Question Name in Data   Name in Program Question Name in Data

Round 1 data:

 

 

Round 8 data:

 

 

Round 9 raw data con't:

 

e3500r1

YSCH-3500

 

e2857r8

YSCH-2857

 

e9691mr9_212

YSCH-9691.02.01.02~M

e5000r1

YSCH-5000

 

e3112r8

YSCH-3112

 

e9691yr9_212

YSCH-9691.02.01.02~Y

t7000r1_1-_3

YTRN-7000.01-.03

 

e3878r8

YSCH-3878

 

e9691mr9_213

YSCH-9691.02.01.03~M

encatr1

CV_ENROLLSTAT

 

t7000r8_1-_7

YTRN-7000.01-.07

 

e9691yr9_213

YSCH-9691.02.01.03~Y

GRSURVr1

CV_HGC_EVER

 

encatr8

CV_ENROLLSTAT

 

e9691mr9_311

YSCH-9691.03.01.01~M

DEGSURVr1

CV_HIGHEST_DEGREE_EVER

 

grsurvr8

CV_HGC_EVER

 

e9691yr9_311

YSCH-9691.03.01.01~Y

gdr1

CV_GED

 

grjuner8

CV_HGC_YR

 

e9691mr9_312

YSCH-9691.03.01.02~M

hsr1

CV_HS_DIPLOMA

 

degsurvr8

CV_HIGHEST_DEGREE_EVER

 

e9691yr9_312

YSCH-9691.03.01.02~Y

doicmr1

CV_INTERVIEW_CMONTH

 

degjuner8

CV_HIGHEST_DEGREE_YR

 

e9691mr9_313

YSCH-9691.03.01.03~M

 

 

 

gdr8

CV_GED

 

e9691yr9_313

YSCH-9691.03.01.03~Y

Round 2 data:

 

 

hsr8

CV_HS_DIPLOMA

 

e9946r9_111-_113

YSCH-9946.01.01.01-.03

e2857r2

YSCH-2857

 

aar8

CV_AA_DEGREE

 

e9946r9_211-_213

YSCH-9946.02.01.01-.03

e3112r2

YSCH-3112

 

bar8

CV_BA_DEGREE

 

e9946r9_311-_313

YSCH-9946.03.01.01-.03

e3878r2

YSCH-3878

 

doicmr8

CV_INTERVIEW_CMONTH

 

e10099mr9_111

YSCH-10099.01.01.01~M

t7000r2_1, _2

YTRN-7000.01, .03

 

comp_mo_LR

From r8 program

 

e10099yr9_111

YSCH-10099.01.01.01~Y

encatr2

CV_ENROLLSTAT

 

comp_yr_LR

From r8 program

 

e10099mr9_112

YSCH-10099.01.01.02~M

grsurvr2

CV_HGC_EVER

 

 

 

 

e10099yr9_112

YSCH-10099.01.01.02~Y

grjuner2

CV_HGC_YR

 

Round 9 raw data:

 

 

e10099mr9_113

YSCH-10099.01.01.03~M

degsurvr2

CV_HIGHEST_DEGREE_EVER

 

e3103r9

YSCH-3103

 

e10099yr9_113

YSCH-10099.01.01.03~Y

degjuner2

CV_HIGHEST_DEGREE_YR

 

e3104r9

YSCH-3104

 

e10099mr9_211

YSCH-10099.02.01.01~M

hsr2

CV_HS_DIPLOMA

 

e2806r9

YSCH-2806

 

e10099yr9_211

YSCH-10099.02.01.01~Y

gdr2

CV_GED

 

e2857r9

YSCH-2857

 

e10099mr9_212

YSCH-10099.02.01.02~M

doicmr2

CV_INTERVIEW_CMONTH

 

e3010r9

YSCH-3010

 

e10099yr9_212

YSCH-10099.02.01.02~Y

 

 

 

e3061r9

YSCH-3061

 

e10099mr9_213

YSCH-10099.02.01.03~M

Round 3 data:

 

 

e3112r9

YSCH-3112

 

e10099yr9_213

YSCH-10099.02.01.03~Y

e2857r3

YSCH-2857

 

e3877r9

YSCH-3877

 

e10099mr9_311

YSCH-10099.03.01.01~M

e3112r3

YSCH-3112

 

e3877br9

YSCH-3877B

 

e10099yr9_311

YSCH-10099.03.01.01~Y

e3878r3

YSCH-3878

 

e3878r9

YSCH-3878

 

e10099mr9_312

YSCH-10099.03.01.02~M

t7000r3_1-_4

YTRN-7000.01-.04

 

e4785mr9

YSCH-4785~M

 

e10099yr9_312

YSCH-10099.03.01.02~Y

encatr3

CV_ENROLLSTAT

 

e4785yr9

YSCH-4785~Y

 

e10099mr9_313

YSCH-10099.03.01.03~M

grsurvr3

CV_HGC_EVER

 

e4793r9

YSCH-4793

 

e10099yr9_313

YSCH-10099.03.01.03~Y

grjuner3

CV_HGC_YR

 

e4795r9

YSCH-4795

 

e24889mr9

YSCH-24889~M

degsurvr3

CV_HIGHEST_DEGREE_EVER

 

e4846mr9

YSCH-4846~M

 

e24889yr9

YSCH-24889~Y

degjuner3

CV_HIGHEST_DEGREE_YR

 

e4846yr9

YSCH-4846~Y

 

e24940mr9

YSCH-24940~M

gdr3

CV_GED

 

e1600r9

YSCH-1600

 

e24940yr9

YSCH-24940~Y

hsr3

CV_HS_DIPLOMA

 

e1605r9

YSCH-1605

 

e27337r9_1-_4

YSCH-27337.01-.04

aar3

CV_AA_DEGREE

 

e1610mr9_1

YSCH-1610.01~M

 

e23450r9_1-_3

YSCH-23450.01-.03

bar3

CV_BA_DEGREE

 

e1610yr9_1

YSCH-1610.01~Y

 

t7000r9_1-_9

YTRN-7000.01-.09

doicmr3

CV_INTERVIEW_CMONTH

 

e1610mr9_2

YSCH-1610.02~M

 

PUBID

PUBID

 

 

 

e1610yr9_2

YSCH-1610.02~Y

 

intdr9

SYMBOL_CURDATE~D

Round 4 data:

 

 

e1615r9_1, _2

YSCH-1615.01, .02

 

intmr9

SYMBOL_CURDATE~M

e2857r4

YSCH-2857

 

e1620mr9_1

YSCH-1620.01~M

 

intyr9

SYMBOL_CURDATE~Y

e3112r4

YSCH-3112

 

e1620yr9_1

YSCH-1620.01~Y

 

PREVGRADE_IN_r9

SYMBOL_PREV_GRADE_IN

e3878r4

YSCH-3878

 

e1624r9_1

YSCH-1624.01

 

 

 

t7000r4_1-_4

YTRN-7000.01-.04

 

e1625r9_1

YSCH-1625.01

 

Round 9 roster data:

 

encatr4

CV_ENROLLSTAT

 

e1627r9_1

YSCH-1627.01

 

lftscr9_1-_4

NEWSCHOOL_LEFT.01-.04

grsurvr4

CV_HGC_EVER

 

e4951r9

YSCH-4951

 

scoder9_1-_4

NEWSCHOOL_SCHCODE.01-.04

grjuner4

CV_HGC_YR

 

e5458r9_1-_3

YSCH-5458.01-.03

 

strtmr9_11

NEWSCHOOL_START1.01~M

degsurvr4

CV_HIGHEST_DEGREE_EVER

 

e6682mr9_1

YSCH-6682.01~M

 

strtyr9_11

NEWSCHOOL_START1.01~Y

degjuner4

CV_HIGHEST_DEGREE_YR

 

e6682yr9_1

YSCH-6682.01~Y

 

strtmr9_12

NEWSCHOOL_START1.02~M

gdr4

CV_GED

 

e6682mr9_2

YSCH-6682.02~M

 

strtyr9_12

NEWSCHOOL_START1.02~Y

hsr4

CV_HS_DIPLOMA

 

e6682yr9_2

YSCH-6682.02~Y

 

strtmr9_13

NEWSCHOOL_START1.03~M

aar4

CV_AA_DEGREE

 

e6682mr9_3

YSCH-6682.03~M

 

strtyr9_13

NEWSCHOOL_START1.03~Y

bar4

CV_BA_DEGREE

 

e6682yr9_3

YSCH-6682.03~Y

 

strtmr9_14

NEWSCHOOL_START1.04~M

doicmr4

CV_INTERVIEW_CMONTH

 

e6784r9_1-_3

YSCH-6784.01-.03

 

strtyr9_14

NEWSCHOOL_START1.04~Y

 

 

 

e6835mr9_1

YSCH-6835.01~M

 

stopmr9_11

NEWSCHOOL_STOP1.01~M

Round 5 data:

 

 

e6835yr9_1

YSCH-6835.01~Y

 

stopyr9_11

NEWSCHOOL_STOP1.01~Y

e2857r5

YSCH-2857

 

e6835mr9_2

YSCH-6835.02~M

 

stopmr9_12

NEWSCHOOL_STOP1.02~M

e3112r5

YSCH-3112

 

e6835yr9_2

YSCH-6835.02~Y

 

stopyr9_12

NEWSCHOOL_STOP1.02~Y

e3878r5

YSCH-3878

 

e6835mr9_3

YSCH-6835.03~M

 

stopmr9_13

NEWSCHOOL_STOP1.03~M

t7000r5_1-_4

YTRN-7000.01-.04

 

e6835yr9_3

YSCH-6835.03~Y

 

stopyr9_13

NEWSCHOOL_STOP1.03~Y

encatr5

CV_ENROLLSTAT

 

e6889r9_1-_3

YSCH-6889.01-.03

 

stopmr9_14

NEWSCHOOL_STOP1.04~M

grsurvr5

CV_HGC_EVER

 

e6937r9_1-_3

YSCH-6937.01-.03

 

stopyr9_14

NEWSCHOOL_STOP1.04~Y

grjuner5

CV_HGC_YR

 

e6938r9_1-_3

YSCH-6938.01-.03

 

strtmr9_21

NEWSCHOOL_START2.01~M

degsurvr5

CV_HIGHEST_DEGREE_EVER

 

e6941mr9_11

YSCH-6941.01.01~M

 

strtyr9_21

NEWSCHOOL_START2.01~Y

degjuner5

CV_HIGHEST_DEGREE_YR

 

e6941yr9_11

YSCH-6941.01.01~Y

 

strtmr9_23

NEWSCHOOL_START2.03~M

gdr5

CV_GED

 

e6941mr9_21

YSCH-6941.02.01~M

 

strtyr9_23

NEWSCHOOL_START2.03~Y

hsr5

CV_HS_DIPLOMA

 

e6941yr9_21

YSCH-6941.02.01~Y

 

stopmr9_21

NEWSCHOOL_STOP2.01~M

aar5

CV_AA_DEGREE

 

e6943r9_11

YSCH-6943.01.01

 

stopyr9_21

NEWSCHOOL_STOP2.01~Y

bar5

CV_BA_DEGREE

 

e6943r9_21

YSCH-6943.02.01

 

strtmr9_31

NEWSCHOOL_START3.01~M

doicmr5

CV_INTERVIEW_CMONTH

 

e6944mr9_11

YSCH-6944.01.01~M

 

strtyr9_31

NEWSCHOOL_START3.01~Y

 

 

 

e6944yr9_11

YSCH-6944.01.01~Y

 

stopmr9_31

NEWSCHOOL_STOP3.01~M

Round 6 data:

 

 

e6947r9_11

YSCH-6947.01.01

 

stopyr9_31

NEWSCHOOL_STOP3.01~Y

e2857r6

YSCH-2857

 

e7142r9_11

YSCH-7142.01.01

 

 

 

e3112r6

YSCH-3112

 

e7142r9_21

YSCH-7142.02.01

 

Round 9 created variables:

 

e3878r6

YSCH-3878

 

e7192r9_1-_3

YSCH-7192.01-.03

 

CDTGD

CV_GED

t7000r6_1-_4

YTRN-7000.01-.04

 

e8416r9_11, _12

YSCH-8416.01.01, .02

 

CDTHS

CV_HS_DIPLOMA

encatr6

CV_ENROLLSTAT

 

e8416r9_21

YSCH-8416.02.01

 

CDTAA

CV_AA_DEGREE

grsurvr6

CV_HGC_EVER

 

e8416r9_31

YSCH-8416.03.01

 

CDTBA

CV_BA_DEGREE

grjuner6

CV_HGC_YR

 

e8774mr9_11

YSCH-8774.01.01~M

 

CDTMA

CV_MA_DEGREE

degsurvr6

CV_HIGHEST_DEGREE_EVER

 

e8774yr9_11

YSCH-8774.01.01~Y

 

doicmr9

CV_INTERVIEW_CMONTH

degjuner6

CV_HIGHEST_DEGREE_YR

 

e8774mr9_12

YSCH-8774.01.02~M

 

intmr9

CV_INTERVIEW_DATE~M

gdr6

CV_GED

 

e8774yr9_12

YSCH-8774.01.02~Y

 

intyr9

CV_INTERVIEW_DATE~Y

hsr6

CV_HS_DIPLOMA

 

e9131r9_11, _12

YSCH-9131.01.01, .02

 

 

 

aar6

CV_AA_DEGREE

 

e9131r9_21

YSCH-9131.02.01

 

 

 

bar6

CV_BA_DEGREE

 

e9131r9_31

YSCH-9131.03.01

 

 

 

doicmr6

CV_INTERVIEW_CMONTH

 

e9335mr9_11

YSCH-9335.01.01~M

 

 

 

 

 

 

e9335yr9_11

YSCH-9335.01.01~Y

 

 

 

Round 7 data:

 

 

e9335mr9_21

YSCH-9335.02.01~M

 

 

 

e2857r7

YSCH-2857

 

e9335yr9_21

YSCH-9335.02.01~Y

 

 

 

e3112r7

YSCH-3112

 

e9335mr9_31

YSCH-9335.03.01~M

 

 

 

e3878r7

YSCH-3878

 

e9335yr9_31

YSCH-9335.03.01~Y

 

 

 

t7000r7_1-_4

YTRN-7000.01-.04

 

e9589r9_111-_113

YSCH-9589.01.01.01-.03

 

 

 

encatr7

CV_ENROLLSTAT

 

e9589r9_211-_213

YSCH-9589.02.01.01-.03

 

 

 

grsurvr7

CV_HGC_EVER

 

e9589r9_311-_313

YSCH-9589.03.01.01-.03

 

 

 

grjuner7

CV_HGC_YR

 

e9691mr9_111

YSCH-9691.01.01.01~M

 

 

 

degsurvr7

CV_HIGHEST_DEGREE_EVER

 

e9691yr9_111

YSCH-9691.01.01.01~Y

 

 

 

degjuner7

CV_HIGHEST_DEGREE_YR

 

e9691mr9_112

YSCH-9691.01.01.02~M

 

 

 

gdr7

CV_GED

 

e9691yr9_112

YSCH-9691.01.01.02~Y

 

 

 

hsr7

CV_HS_DIPLOMA

 

e9691mr9_113

YSCH-9691.01.01.03~M

 

 

 

aar7

CV_AA_DEGREE

 

e9691yr9_113

YSCH-9691.01.01.03~Y

 

 

 

bar7

CV_BA_DEGREE

 

e9691mr9_211

YSCH-9691.02.01.01~M

 

 

 

doicmr7

CV_INTERVIEW_CMONTH

 

e9691yr9_211

YSCH-9691.02.01.01~Y

 

 

 

Codes for Created Variables

Youth's Enrollment Status as of the Survey Date (ENCAT
1. not enrolled, no high school degree, no GED
2. not enrolled, GED, but no high school degree
3. not enrolled, a high school degree, no GED
4. not enrolled, some college
5. not enrolled, 2 year college graduate
6. not enrolled, 4 year college graduate
7. not enrolled, graduate degree
8. enrolled in grades 1-12
9. enrolled in a 2 year college
10. enrolled in a 4 year program
11. enrolled in a graduate program

 

Highest Grade Completed as of the Survey Date (GRSURV)
0.  none
1.  first
2.  second
3.  third
4.  fourth
5.  fifth
6.  sixth
7.  seventh
8.  eighth
9.  ninth
10. tenth
11. eleventh
12. twelfth
13. first year college
14. second year college
15. third year college
16. fourth year college
17. fifth year college
18. sixth year college
19. seventh year college
20. eighth year college
95. ungraded                

 

Highest Degree Received as of the Survey Date (DESURV)
0. none
1. GED
2. high school diploma
3. junior college or 2-year associate degree
4. bachelor's degree (B.A., B.S., or unspecified)
5. master's degree
6. doctoral degree
7. professional degree (M.D., L.L.D., D.D.S., J.D.)

 

Highest Grade Completed as of August 31, 2005 (GRAUG)
0.  none
1.  first
2.  second
3.  third
4.  fourth
5.  fifth
6.  sixth
7.  seventh
8.  eighth
9.  ninth
10. tenth
11. eleventh
12. twelfth
13. first year college
14. second year college
15. third year college
16. fourth year college
17. fifth year college
18. sixth year college
19. seventh year college
20. eighth year college
95. ungraded                

 

Highest Degree Completed as of August 31, 2005 (DEGAUG)
0. none
1. GED
2. high school diploma
3. junior college or 2-year associate degree
4. bachelor's degree (B.A., B.S., or unspecified)
5. doctoral degree
6. professional degree (M.D., L.L.D., D.D.S., J.D.)

This program first creates an enrollment status variable for each respondent.  It then identifies the highest grade completed by the respondent as of the round 9 interview date and as of August 31, 2005 (that is, the highest grade completed by the start of the new academic year).  Finally, it determines the highest degree or diploma received by the respondent as of the same two dates.

  1. Rs who report receiving both a GED and a H. S. Diploma are coded as receiving a H. S. Diploma
  2. Rs who report completing 12th grade but do not report receiving a H. S. Diploma or GED are coded as having completed 12th grade (in GRSURV and GRAUG, if applicable) but are not credited with a H. S. Diploma/GED on ENCAT, DEGSURV, or DEGAUG. Researchers interested in diploma receipt should use the DEGSURV or ENCAT variables, not HGC as of survey date since 12th grade completion does not necessarily signify H.S. Diploma completion.
  3. Due to conflicting reports from a small number of Rs regarding their school attendance in the loops versus in single items, invalid skips (-3) have been filled in since no reasonable determination on the enrollment and grades completed can be made (ENCAT, GRSURV, GRAUG). Specifically, Rs are assigned a -3 if they:
    a) report being not enrolled and
    b) report a HGC on the single items (e3112) that is greater than the cv_highest_degree_ever  for the prior round (but do not indicate completing this grade in a loop) and
    c) report that their HGA (e2857) is two or more greater than the HGC reported in the prior round. Since  these Rs provide inconsistent information multiple times, they have been assigned a -3.  If they provide valid information on degrees earned, that variable will have a value.
  4. Some respondents provide conflicting information of grades attended/completed in the  schooling loops (e8416 and e9589) versus the single items (e3112, e2857). These Rs were identified as below where (ENROLL=0 and 12>=e3112^=GRSURV>0 and DEGSURV not in (1,2) and GRSURV^=95) or (0<maxgrade=GRSURV<95 and GRSURV^=e3112 and e3112<=12)
    This program gives priority to information provided in the schooling loops over that provided on single item questions. Users may wish to check the CV_HGC_EVER variable against student single item self-reports of HGC (e3112), which in many cases indicates a higher grade was completed than that reported in the loops.
  5. Even if we do not have a date for the degree received (or we have an invalid date) we code the DEGSURV for that degree.
  6. If R reports being in a 4year college or university (this is one category) and pursuing a degree higher than a bachelor's we code their enrollment status as enrolled in a graduate program (ENCAT=11). The problem here is that since we are not sure whether they are in a 4-year college or a university, we are not sure whether their they are actually in a graduate program or in a bachelor's program but their ultimate academic goal is a graduate program. There are 54 cases in this category who do not have an Associates or Bachelor's degree. We could have used that criterion to identify those actually in a graduate program. The problem is that there are programs which give only a graduate degree without a bachelor's degree. So we code all these as ENCAT=11. If the questionnaire is changed to accommodate the graduate program option, these may be recoded in later rounds.

********************************************** SECTION I **********************************************;

** Initialize and define variables;

ENROLL=-3; * Indicates if R currently enrolled;

ENCAT=-3; * Enrollment status variable (including educational attainment);

HSD=0; * Indicates if R has a H. S. Diploma (check previous rounds);

GED=0; * Indicates if R has a GED (check previous rounds);

hgsch=0; * Indicates if R is currently attending grades 1-12 & no HSD or GED;

college=0; * Indicates if R is in college and working towards a undergrad (=1) or grad degree (=2);

attsch=0; * Indicates if R attended elementary, middle or high school;

flagcoll=0; * Indicates if Rs currently attending grades 1-12, no HSD or GED but enrolled in college
and working towards a grad or undergrad degree;

flaghs=0; * Indicates if Rs who have a H.S. Diploma and HGC=12 but still report enrollment in school;

somecoll=0; * Indicates if Rs have attended a college (in a degree program) in current or previous
rounds;

prevcoll=0; * Indicates if Rs have attended a college (in a degree program) in previous rounds. This
pertains to those actually enrolled in a degree program in college only;

currcoll=0; * Indicates if Rs have attended a college (in a degree program) in current round. This
pertains to those enrolled in a college and reporting to be working towards a degree
program. They may or may not be enrolled in a degree program.;

clg_ok=-4; * Indicates if R being in college (as reported in this round) w/o GED/HSD is OK. That is if
R is actually enrolled in a degree program. This pertains to currcoll and not prevcoll.;

last_enr=0; * Identifies the last round when R was enrolled;

ungraded=0; * Indicates Rs with no H.S. Diploma or GED have HGA=95 (ungraded);

same_mth=0; * Indicates Rs who received a degree in the same month as the interview.;

both=0; * Indicates that R reports receiving both GED and H. S. Diploma;

rosprb1=0; * Indicates Rs with scode(i) in (4,5) but e27337(i)=-4;

rosprb2=0; * Indicates Rs with scode(i)=-4 but e27337(i)>-4;

rosprb3=0; * Indicates cases where start and stop dates of enrollment and school codes are missing
from Roster although information is available in the data;

rosprb4=0; * Indicates cases wherer stop dates of enrollment in the Roster is not the date of current
interview although R reports being continuously enrolled in that school;

rosprb5=0; * Indicates a few special cases where the reason for leaving school were interchanged
between school loops 1 and 2;

fill=-4; * These are filler variables that are used in arrays to match the number of elements.;

chk_comm=0; * Indicates if R reports college in this round although R does not report receiving GED or
H.S. Diploma, by this round. Check the comments in current round to see whether they
were actually enrolled in a degree program in a college.;

chk_commP=0; * Indicates if ENCAT in any prior rounds shows college although R does not report
receiving GED or HS Diploma, by those rounds. Check the comments in current and earlier
rounds for these cases to see whether they were actually enrolled in a degree program in
a college.;

chk_hgc=0; * Those who received a H.S. Diploma, but report HGA<=12 & HGC<12;

chk_grmon=0; * Indicate cases where GRSURV is coded with the GRSURV at DLI, i.e., grsurvP. In these
cases we must check whether that grade was completed by June of 2004 to ensure that
coding GRMON also by grsurvP is correct.;

hgc_hga=0; * Indicates if Rs reporting HGC greater than HGA;

hgc_hga_n=-4; * Indicates if Rs reporting HGC greater than HGA, after HGC and HGA were edited for those
never enrolled at or since DLI such that they remained the same as those at DLI.;

**************************************************************
** dlicm: date of last interview **
** dli_rnd: the last round that R was interviewed **
** doicm: date of current interview **
** enroll_Rx: whether enrolled in earlier rounds **
** encatP: ENCAT when last interviewed **
** hgaloop: highest grade attended (from loops) **
** hgcloop: highest grade completed (from loops) **
** hgcdt: date of completion of hgcloop **
**************************************************************;

MONYR=308;
YEAR=2005;
MONTH=8;
doicm_LR=doicmr8;

*** Define arrays to be used later in the program;
array scode (4) scoder9_1-scoder9_4;
array e27337 (4) e27337r9_1-e27337r9_4;
array strtm (6) strtmr9_11-strtmr9_14 strtmr9_21 strtmr9_31;
array strty (6) strtyr9_11-strtyr9_14 strtyr9_21 strtyr9_31;
array stopm (6) stopmr9_11-stopmr9_14 stopmr9_21 stopmr9_31;
array stopy (6) stopyr9_11-stopyr9_14 stopyr9_21 stopyr9_31;
array degre (6) e27337r9_1-e27337r9_4 e27337r9_1 e27337r9_1;
array codes (6) scoder9_1-scoder9_4 scoder9_1 scoder9_1;
array reasn (6) lftscr9_1-lftscr9_4 lftsc2r9_1 lftsc3r9_1;
array strcm (6) strcm11-strcm14 strcm21 strcm31;
array stpcm (6) stpcm11-stpcm14 stpcm21 stpcm31;

* Start month from roster;
array oldstrtm (4) strtmr9_11 strtmr9_12 strtmr9_13
strtmr9_21;

* Start year from roster;
array oldstrty (4) strtyr9_11 strtyr9_12 strtyr9_13
strtyr9_21;

* Corrected start month;
array e8774m (4) e8774mr9_11 e8774mr9_21 e8774mr9_31
e8774mr9_12;

* Corrected start year;
array e8774y (4) e8774yr9_11 e8774yr9_21 e8774yr9_31
e8774yr9_12;

* Grades attended;
array gratnd (13) e8416r9_11 e8416r9_12 e8416r9_21 e8416r9_31
e9589r9_111-e9589r9_113 e9589r9_211-e9589r9_213
e9589r9_311-e9589r9_313;

* Grade completed;
array grcomp (13) e9131r9_11 e9131r9_12 e9131r9_21 e9131r9_31
e9946r9_111-e9946r9_113 e9946r9_211-e9946r9_213
e9946r9_311-e9946r9_313;

* start date - year;
array yrstrt (13) e8774yr9_11 e8774yr9_12 e8774yr9_21 e8774yr9_31
e9691yr9_111-e9691yr9_113 e9691yr9_211-e9691yr9_213
e9691yr9_311-e9691yr9_313;

* start date - month;
array mostrt (13) e8774mr9_11 e8774mr9_12 e8774mr9_21 e8774mr9_31
e9691mr9_111-e9691mr9_113 e9691mr9_211-e9691mr9_213
e9691mr9_311-e9691mr9_313;

* Date of completion - year;
array yrcomp (13) e9335yr9_11 e9335yr9_12 e9335yr9_21 e9335yr9_31
e10099yr9_111-e10099yr9_113 e10099yr9_211-e10099yr9_213
e10099yr9_311-e10099yr9_313;

* Date of completion - month;
array mocomp (13) e9335mr9_11 e9335mr9_12 e9335mr9_21 e9335mr9_31
e10099mr9_111-e10099mr9_113 e10099mr9_211-e10099mr9_213
e10099mr9_311-e10099mr9_313;

array t7000A (*) t7000:;
array e6784 (3) e6784r9_1-e6784r9_3;
array e6938 (3) e6938r9_1-e6938r9_3;
array e7192 (3) e7192r9_1-e7192r9_3;
array e7142 (3) e7142r9_11 e7142r9_21 dum;
array e6943 (3) e6943r9_11 e6943r9_21 dum;
array doicmR (8) doicmr1-doicmr8;
array intmR (8) intmr1-intmr8;
array intyR (8) intyr1-intyr8;
array encatR (8) encatr1-encatr8;
array enrollR (8) enrollr1-enrollr8;
array grsurvR (8) grsurvr1-grsurvr8;
array grmonR (8) grmonr1-grmonr8;
array graugR (8) graugr1-graugr8;
array degsurvR (8) degsurvr1-degsurvr8;
array grsurvFR (8) grsurvFr1-grsurvFr8;
array hgaR (8) e3500r1 e2857r2-e2857r8;
array hgcR (8) e5000r1 e3112r2-e3112r8;
array hsrR (8) hsr1-hsr8;
array gdrR (8) gdr1-gdr8;

array scoder [8,7] scoder1_1 dum dum dum dum dum dum
scoder2_1-scoder2_6 dum
scoder3_1-scoder3_7
scoder4_1-scoder4_5 dum dum
scoder5_1-scoder5_6 dum
scoder6_1-scoder6_4 dum dum dum
scoder7_1-scoder7_5 dum dum
scoder8_1-scoder8_5 dum dum;

*** HAND EDIT (1);
if pubid=413 then do;
stopmr9_11=11;
end;

*** Create intermediate variables to be used in the program later.;
do i=1 to dim(oldstrtm);
if e8774y(i)<=0 then do;
e8774y(i)=oldstrty(i);
e8774m(i)=oldstrtm(i);
end;
end;

** Checking int dates;
if e3112r9~=-5 then doicmr9=((intyr9-1980)*12)+intmr9;
if doicmr9~=-5 then doicm=doicmr9;

* Whether received GED, ever;
if CDTGD>-4 then GED=1;
* Whether received HS Diploma, ever;
if CDTHS>-4 then HSD=1;
* Whether received both GED and HS Diploma, ever;
if HSD=1 & GED=1 then both=1;

* Compute dlicm and dli_rnd;
do j=1 to dim(doicmR);
if doicmR(j)~=-5 then do;
dlicm=doicmR(j);
dlim=intmr(j);
dliy=intyr(j);
dli_rnd=j;
do k=1 to 7;
if scoder(j,k) in (4,5) then ever_24yrinst=1;
end;
hsrP=hsrR(j);
gdrP=gdrR(j);
grsurvFP=grsurvFR(j);
end;
end;
if HSD=0 & hsrP>-4 then hsrP=-4;
if GED=0 & gdrP>-4 then gdrP=-4;

* Enrollment status at each interview and ENCAT at last interview;
do i=1 to dim(doicmR);
if encatR(i) in (8,9,10,11) then enrollR(i)=1;
if encatR(i) in (1,2,3,4,5,6,7) then enrollR(i)=0;
if -5<encatR(i)<0 then enrollR(i)=encatR(i);
if encatR(i)~=-5 then encatP=encatR(i);
if enrollR(i)~=-5 then enrollP=enrollR(i);
if enrollR(i)=1 then last_enr=i;
if hgaR(i)~=-5 then hgaP=hgaR(i);
end;

* Create variable indicating HGC by DLI;
do i=1 to dim(grsurvR);
if grsurvR(i)>-5 then grsurvP=grsurvR(i);
if grmonR(i)>-5 then grmonP=grmonR(i);
if graugR(i)>-5 then graugP=graugR(i);
end;
grsurvP_no3061=grsurvP;
if e3061r9>0 & GED=0 then grsurvP=e3061r9;
if e3061r9>0 & GED=1 & e3061r9~=12 then grsurvP=e3061r9;
if grsurvP<grmonP<95 then grmonP=grsurvP;

* Create variable indicating Highest Degree Received by DLI;
do i=1 to dim(degsurvR);
if degsurvR(i)~=-5 then degsurvP=degsurvR(i);
end;

* Expected date of graduation;
if e24889mr9>-4 & e24889yr9>-4 then do;
gradyr9=e24889yr9;
gradmr9=e24889mr9;
if e24889mr9>0 & e24889yr9>0 then gradcm=(((e24889yr9-1980)*12)+e24889mr9);
if -3<=e24889mr9<=-1 & e24889yr9>0 then gradcm=(((e24889yr9-1980)*12)+6);
if -3<=e24889yr9<=-1 then gradcm=-3;
if intmr9<5 then do;
if gradyr9=intyr9+0 then expcurrgr=11;
if gradyr9=intyr9+1 then expcurrgr=10;
if gradyr9=intyr9+2 then expcurrgr=9;
if gradyr9=intyr9+3 then expcurrgr=8;
if gradyr9=intyr9+4 then expcurrgr=7;
end;
if intmr9>=8 then do;
if gradyr9=intyr9+1 then expcurrgr=11;
if gradyr9=intyr9+2 then expcurrgr=10;
if gradyr9=intyr9+3 then expcurrgr=9;
if gradyr9=intyr9+4 then expcurrgr=8;
if gradyr9=intyr9+5 then expcurrgr=7;
end;
end;
if e24940mr9>-4 & e24940yr9>-4 then do;
gradyr9=e24940yr9;
gradmr9=e24940mr9;
if e24940mr9>0 & e24940yr9>0 then gradcm=(((e24940yr9-1980)*12)+e24940mr9);
if -3<=e24940mr9<=-1 & e24940yr9>0 then gradcm=(((e24940yr9-1980)*12)+6);
if -3<=e24940yr9<=-1 then gradcm=-3;
if intmr9<8 then do;
if gradyr9=intyr9+1 then expcurrgr=11;
if gradyr9=intyr9+2 then expcurrgr=10;
if gradyr9=intyr9+3 then expcurrgr=9;
if gradyr9=intyr9+4 then expcurrgr=8;
if gradyr9=intyr9+5 then expcurrgr=7;
end;
if intmr9>=8 then do;
if gradyr9=intyr9+2 then expcurrgr=11;
if gradyr9=intyr9+3 then expcurrgr=10;
if gradyr9=intyr9+4 then expcurrgr=9;
if gradyr9=intyr9+5 then expcurrgr=8;
if gradyr9=intyr9+6 then expcurrgr=7;
end;
end;

** Start and stop dates of enrollment in continuous month scheme;
do i=1 to dim(degre);
if stopm(i)>0 & stopy(i)>0 then stpcm(i)=((stopy(i)-1980)*12)+stopm(i);
if -4<stopm(i)<0|-4<stopy(i)<0 then stpcm(i)=-3;
if strtm(i)>0 & strty(i)>0 then strcm(i)=((strty(i)-1980)*12)+strtm(i);
if -4<strtm(i)<0|-4<strty(i)<0 then strcm(i)=-3;
end;

** Data and quex problems w/ roster information;
rosprb1=0; rosprb2=0;
do i=1 to dim(scode);
if (scode(i)=4|scode(i)=5) & e27337(i)=-4 then rosprb1=1;
if scode(i)=-4 & e27337(i)>-4 then rosprb2=1;
if scode(i) in (-2,-3) then INV1=1;
if scode(i) in (4,5) & e27337(i) in (-2,-3) then INV2=1;
end;
do i=1 to dim(strcm);
if strcm(i)=-3 then INV3=1;
if stpcm(i)=-3 then INV3=2;
if strcm(i)=-3 & stpcm(i)=-3 then INV3=3;
end;

* Last regular school enrolled in, its start and stop date of enrollment, type of school and degree
working towards & school loop number;
STOP=-4;
do i=1 to dim(degre);
if stpcm(i)>STOP then do;
STOP=stpcm(i);
STRT=strcm(i);
sch=codes(i);
deg=degre(i);
rosnum=i;
STOP_loc=1;
end;
if stpcm(i)=STOP & sch in (4,5) & codes(i)=sch & deg in (1,3,4,5,6,10) & degre(i)=deg then do;
STOP=stpcm(i);
STRT=strcm(i);
sch=codes(i);
deg=degre(i);
rosnum=i;
STOP_loc=2;
end;
if 0<stpcm(i)<STOP & 0<cdths<STOP & STOP=doicm & 0<STRT<strcm(i) & 0<cdths<=strcm(i)
& codes(i) in (4,5) & sch in (1,2,3) & degre(i) in (1,3,4,5,6,10) & deg not in (1,3,4,5,6,10) then do;
STOP=stpcm(i);
STRT=strcm(i);
sch=codes(i);
deg=degre(i);
rosnum=i;
STOP_loc=3.1;
end;
if 0<stpcm(i)<STOP & 0<cdtgd<STOP & STOP=doicm & 0<STRT<strcm(i) & 0<cdtgd<=strcm(i)
& codes(i) in (4,5) & sch in (1,2,3) & degre(i) in (1,3,4,5,6,10) & deg not in (1,3,4,5,6,10) then do;
STOP=stpcm(i);
STRT=strcm(i);
sch=codes(i);
deg=degre(i);
rosnum=i;
STOP_loc=3.2;
end;
if stpcm(i)=STOP & codes(i)=5 & sch=4 & degre(i) in (1,3,4,5,6,10) & deg in (1,3,4,5,6,10) then do;
STOP=stpcm(i);
STRT=strcm(i);
sch=codes(i);
deg=degre(i);
rosnum=i;
STOP_loc=4;
end;
if stpcm(i)=STOP & codes(i)=5 & sch=5 & degre(i) in (4,5,6,10) & deg in (1,3) then do;
STOP=stpcm(i);
STRT=strcm(i);
sch=codes(i);
deg=degre(i);
rosnum=i;
STOP_loc=5;
end;
if stpcm(i)=STOP & codes(i) in (4,5) & sch in (1,2,3) & (HSD=1|GED=1) then do;
STOP=stpcm(i);
STRT=strcm(i);
sch=codes(i);
deg=degre(i);
rosnum=i;
STOP_loc=6;
end;
if 0<stpcm(i)<=STOP & codes(i)in (1,2,3) & sch in (1,2,3) & STOP=doicm & strcm(i)>=STRT>0 then do;
STOP=stpcm(i);
STRT=strcm(i);
sch=codes(i);
deg=degre(i);
rosnum=i;
STOP_loc=7;
end;
if stpcm(i)=STOP & STOP=doicm & 0<STRT<strcm(i) & codes(i) in (4,5) & sch in (4,5)
& degre(i) in (1,3,4,5,6,10) & deg not in (1,3,4,5,6,10) then do;
STRT=strcm(i);
sch=codes(i);
deg=degre(i);
rosnum=i;
STOP_loc=8;
end;
end;
* dual enrollment - R is enrolled in a high school and college simultaneously.;
do i=1 to dim(degre);
if stpcm(i)=STOP & codes(i) in (1,2,3) & sch in (4,5) & HSD=0 & GED=0 then do;
STOP=stpcm(i);
STRT=strcm(i);
sch=codes(i);
deg=degre(i);
rosnum=i;
STOP_loc=9;
end;
end;

if STOP>0 then diff=doicm-STOP;
do i=1 to dim(degre);
if rosnum=i then do;
if STOP=doicm & stpcm(i)=doicm & reasn(i)>-4 then diff=10000;
end;
end;
do i=1 to dim(degre);
if strcm(i)>=-3 & stpcm(i)>=-3 then lastloopnum=i;
end;

* Whether the last school attended was High School or College, and if the latter then for what degree;
if sch in (-1,-2,-3) then lastsch=-3;
if sch=6 then lastsch=6;
if sch in (1,2,3) then lastsch=1;
if sch in (4,5) and deg in (1,3,4,5,6,10) then lastsch=2;
if sch in (4,5) and deg in (2,7,8,999) then lastsch=2.1;
if sch in (4,5) and deg=9 then lastsch=2.2;
if sch in (4,5) and deg in (-1,-2,-3) then lastsch=2.3;
if sch in (4,5) and deg=-4 then lastsch=2.4;

** Hand edits;
if pubid in (420 430 1557 4293 4294  4793 5408 5840 6023 6719
 7035 7186 7221 7235 7974 8870) then do;
lastsch=2;
deg=3;
currcoll=1;
end;
if pubid in (2311 2744 4558 8232 9008) then do;
lastsch=2;
deg=1;
currcoll=1;
end;
if pubid=4136 then do;
lastsch=2;
deg=4;
currcoll=1;
end;
if pubid in (1687 3287 4281 7143) then do;
lastsch=2;
deg=3;
sch=5;
currcoll=1;
end;
if pubid in (794 327 7373 8284) then do;
lastsch=2;
deg=4;
sch=5;
currcoll=1;
end;
if pubid in (3786) then do;
lastsch=2;
deg=6;
sch=5;
currcoll=1;
end;
if pubid in (1843) then do;
lastsch=2.1;
end;

if lastsch=6 & deg in (4,5,6,10) & CDTBA>-4 then do;
sch=5;
lastsch=2;
end;

* R attended college (in a degree program) in a previous round;
do i=1 to dim(encatR);
if encatR(i) in (4,5,6,7,9,10,11) & degsurvR(i)>=1 then prevcoll=1;
if encatR(i) in (4,5,6,7,9,10,11) & degsurvR(i)<1 then do;
prevcoll=1;
chk_commP=1;
if hsrR(i)>-4|gdrR(i)>-4 then chk_commP=2;
end;
end;

* R attended college (in a degree program) in a previous round and did not correct HGA as of
last interview (e2806) to <13 i.e. accepts being in college as of last interview;
do i=1 to dim(encatR);
if (e2806r9=-4|e2806r9>=13) & encatR(i) in (4,5,6,7,9,10,11) & (hsrR(i)=1|gdrR(i)=1) then prevcoll=1;
if (e2806r9=-4|e2806r9>=13) & encatR(i) in (4,5,6,7,9,10,11) & hsrR(i)=-4 & gdrR(i)=-4 then do;
prevcoll=1;
chk_commP=1;
if 0<CDTHS<=doicmR(i) then chk_commP=2;
if 0<CDTGD<=doicmR(i) then chk_commP=2;
end;
end;

* When R attended college (in a degree program) in this round;
do i=1 to dim(scode);
if scode(i) in (4,5) & e27337(i) in (1,3,4,5,6,10) then currcoll=1;
end;
if hsd=0 & ged=0 & currcoll=1 then chk_comm=1;
if hsd=0 & ged=0 & currcoll=1 & clg_ok=-4 then clg_ok=0;
if (hsd=1|ged=1) & currcoll=1 then clg_ok=1;
if prevcoll=1|currcoll=1 then somecoll=1;

*** Hand edits.;
if pubid in (397 698 1115 1150 1436 1828 1890 2446 2645 2652
2652 3002 3011 3167 3231 3252 3356 3830 4126 4148
4151 4202 4287 4532 4587 4655 4958 5050 5648 5685
5886 6146 6168 6199 6299 6338 6628 6826 6994 7070
7107 7153 7315 7327 7355 7652 7844 7888 7973 8126
8242 8295 8296 8696 8698 8484 8859) & currcoll=1 & clg_ok~=1 then do;
clg_ok=1;
FLG_13900r9=2;
end;

if pubid in (81 100 273 1260 2122 3290 4396 4650 5039 5499
5684 5807 5929 6482 6491 6505 6876 7156 7424
7632 7828 8182 8281 9018) & clg_ok=1 then do;
clg_ok=0;
FLG_13900r9=3;
end;

* Grade information from loops;
hgaloop=e8416r9_11;
do i=2 to dim(gratnd);
if gratnd(i)>hgaloop then do;
hgaloop=gratnd(i);
end;
end;

hgcloop=-16;
do i=1 to dim(gratnd);
if gratnd(i)>=0 & gratnd(i)>hgcloop then do;
if grcomp(i)=1 then do;
hgcloop=gratnd(i);
if mocomp(i)>0 & yrcomp(i)>0 then hgcdt=((yrcomp(i)-1980)*12)+mocomp(i);
if mocomp(i)>0 & yrcomp(i)>0 then hgcdt=-3;
end;
else if grcomp(i) in (-1,-2,-3) then do;
hgcloop=grcomp(i);
end;
end;
if gratnd(i) in (0,-1, -2, -3,-4) & grcomp(i)>-4 then do;
hgcloop=-55;
end;
end;

if (1<=e2857r9<=12) & HSD=0 & GED=0 then hgsch=1;

do i=1 to dim(scode);
if scode(i) in (1,2,3) then attsch=1;
end;

do i=1 to dim(e27337);
if e27337(i) in (1,3) then college=1;
if e27337(i) in (4,5,6,10) then college=2;
if e27337(i) in (-1,-2,-3) then college=-3;
end;

if 0<=e2857r9<e3112r9<95 then hgc_hga=1;
if (0<=e2857r9<12) & e3112r9=12 then hgc_hga=2;
if 0<=e2857r9<=12<e3112r9<95 & hsd=0 & ged=0 then hgc_hga=3.1;
if 0<=e2857r9<=12<e3112r9<95 & (hsd=1|ged=1) then hgc_hga=3.2;
if 12<e2857r9<e3112r9<95 then hgc_hga=4;

** When R was not enrolled at DLI and has not been enrolled since DLI, impute HGA (YSCH-2857)
and HGC (YSCH-3112) as that reported at DLI unless corrected.;
if e3878r9=0 & hgc_hga>=1 then do;
hgc_hga_n=0;
if e3103r9~=0 then e2857r9=hgaR(dli_rnd);
if e3103r9=0 then e2857r9=e3104r9;
if e3010r9~=0 then e3112r9=hgcR(dli_rnd);
if e3010r9=0 then e3112r9=e3061r9;
if 0<=e2857r9<e3112r9<95 then hgc_hga_n=1;
end;

********************************************************************************************************
*** (I) CREATED VARIABLE - ENROLLMENT STATUS (ENCAT) ***
********************************************************************************************************;

*** [IA] Determining whether the respondent is enrolled or not. Note: Summer vacations are included as part of the enrollment period;

if diff=0 then ENROLL=1;
if diff>0 then ENROLL=0;
if -3<=STOP<=-1 then ENROLL=0;
if e3878r9=0 then ENROLL=0;

** If respondent has received a H.S. Diploma, HGA & HGC is 12 and there is a valid end date for
the completed 12th grade then check whether R should be coded as enrolled or not. If R reports
a 2-yr or 4-yr college then R is coded as enrolled irrespective of the type of degree working
towards;

if HSD=1 & hgcloop=12 & hgcdt>0 & ENROLL=1 then do;
chk_enr2=1;
ENROLL=0;
do i=1 to dim(scode);
if scode(i) in (4,5) then ENROLL=1;
end;
end;

** Computing ENROLL by another method - ENROLLx;
if e1624r9_1=1 then flagloop=1; * flag those who re-enroll;

** not enrolled at and sdli;
if e3878r9=0 then enrollx=0;

** old school;
* enrolled at dli, continuously enrolled in old school sdli, no new schools;
if e4795r9=1 & e4951r9=0 then enrollx=1;
* not enrolled at dli but re-enrolled in old school sdli, continuously re-enrolled in old school
sdli, no new schools;
if e4793r9=1 & e4951r9=0 then enrollx=1;
* not continuously enrolled in old school SDLI;
if (e4795r9=0 or e4793r9=0) then do;
*left school upon completing coursework or receiving degree;
if e1605r9=-4 & e4951r9=0 then enrollx=0;
* re-enrolled in old school;
if e1605r9=1 then do;
* continuously re-enrolled in old school, no new schools;
if e1615r9_1=1 & e4951r9=0 then enrollx=1;
* not continuously re-enrolled in old school, first time through loop, no other re-enrollments
at old school, and no new schools;
if e1615r9_1=0 & e1624r9_1=0 & e1627r9_1=0 & e4951r9=0 then enrollx=0;
* continuously re-re-enrolled in old school, no new schools;
if e1615r9_2=1 & e4951r9=0 then enrollx=1;
* not continuously re-re-enrolled in old school, second time through loop;
if e1615r9_2=0 then chk_enrprd=1;
end;
* not re-enrolled in old school, no new schools;
if e1605r9=0 and e4951r9=0 then enrollx=0;
end;

** new school;
* enrolled or not enrolled at dli but enrolled in new school sdli;
if (e4951r9=1 or e3878r9=1) then do;
* continuously enrolled in new school, no other new schools reported;
do i=1 to dim(e6784);
if e6784(i)=1 & e7192(i)=0 then enrollx=1;
end;
* not continuously enrolled in new school, re-enrolled, continuously re-enrolled, no other
new schools reported;
do i=1 to dim(e6784);
if e6784(i)=0 & e7192(i)=0 then do;
if e6943(i)=1 then enrollx=1;
end;
end;
* not continuously enrolled in new school -
(1) re-enrolled, not continuously re-enrolled
(2) left school because completed coursework or received degree,
No other enrollment periods, no other new school;
do i=1 to dim(e6784);
if e7142(i)=0 & e7192(i)=0 then enrollx=0;
end;
* not continuously enrolled in new school, did not re-enroll, no new schools;
do i=1 to dim(e6784);
if e6938(i)=0 & e7192(i)=0 then enrollx=0;
end;
end;

*** (IB) Determining the sub-categories of not enrolled;
if ENROLL=0 then do;

** No H.S. Diploma, no GED - ENCAT=1;
if (GED<=0) & (HSD<=0) then ENCAT=1;

** GED - ENCAT=2;
if GED=1 then ENCAT=2;

** High school degree - ENCAT=3;
if HSD=1 then ENCAT=3;

** R (now not enrolled) attended some college & was enrolled in a degree program.
Note: those who indicated attending a college and working toward a "vocational or technical
certificate" (e27337=2) are coded as not having attended college as these credits
typically won't transfer into a BA or an AA Degree. R attended some college,
perhaps in a prior round, or in current round;
if prevcoll=1 then ENCAT=4;
if currcoll=1 & ((13<=e2857r9<=20)|e3112r9>=12|HSD=1|GED=1|hgcloop=12|clg_ok=1) then ENCAT=4;

** Received junior college or 2 year associate degree - ENCAT=5;
if CDTAA>-4 then ENCAT=5;

** Received bachelor's degree - ENCAT=6;
if CDTBA>-4 then ENCAT=6;

** Received master's, doctoral or professional degree - ENCAT=7;
if CDTMA>-4|CDTDC>-4|CDTPF>-4 then ENCAT=7;
end;

*** (IC) Determining the sub-categories of enrolled;
if ENROLL=1 then do;

if lastsch=1 then do;
if CDTHS>0 & (e3112r9=12|hgcloop=12) then flaghs=1;
if (1<=e2857r9<=12) & HSD<=0 & GED<=0 then ENCAT=8;
if e2857r9=13 & HSD=0 & GED=0 then ENCAT=8;
if e2857r9=95 & HSD=0 & GED=0 then do;
ENCAT=8;
ungraded=1;
end;
end;

if lastsch=2 then do;
if sch=4 & deg in (1,3,4,5,6,10) & ((13<=e2857r9<95)|e3112r9>=12|GED=1|HSD=1|hgcloop=12|clg_ok=1)
then ENCAT=9;
if sch=5 & deg in (1,3,4,5,6,10) & ((13<=e2857r9<95)|e3112r9>=12|GED=1|HSD=1|hgcloop=12|clg_ok=1)
then ENCAT=10;
if sch=5 & deg in (4,5,6,10) & ((16<e2857r9<95)|e3112r9>=16) then ENCAT=11;
if sch=5 & deg in (4,5,6,10) & CDTBA>-4 then ENCAT=11;
if (1<=e2857r9<=12) & HSD=0 & GED=0 & clg_ok~=1 then do;
ENCAT=8;
flagcoll=1;
end;
end;

if lastsch>2 then do;
if GED=0 & HSD=0 & somecoll=0 then ENCAT=8;
if currcoll=0 & prevcoll=1 then do;
ENCAT=4;
if CDTAA>-4 then ENCAT=5;
if CDTBA>-4 then ENCAT=6;
if CDTMA>-4|CDTDC>-4|CDTPF>-4 then ENCAT=7;
end;
if currcoll=1 & (HSD=1|GED=1|clg_ok=1) then ENCAT=4;
end;
if GED=1 & HSD=0 & somecoll=0 then ENCAT=2;
if HSD=1 & somecoll=0 then ENCAT=3;
if (HSD=1|GED=1|clg_ok=1) & currcoll=1 & lastsch=-3 then ENCAT=4;
if (HSD=1|GED=1) & prevcoll=1 & lastsch=-3 then ENCAT=4;
if CDTAA>-4 & somecoll=1 & lastsch=-3 then ENCAT=5;
if CDTBA>-4 & somecoll=1 & lastsch=-3 then ENCAT=6;
end;

** Respondents receiving the bachelor's degree degree in and around the month of the interview are
coded as being enrolled by the program. ENCAT needs to be recoded;
if CDTHS>0 & doicm=CDTHS & ENCAT in (-3,1,2,8) then do;
ENCAT=3;
same_mth=1;
end;

if CDTGD>0 & doicm=CDTGD & ENCAT in (-3,1,8) then do;
ENCAT=2;
same_mth=1;
end;

if CDTAA>0 & doicm=CDTAA & ENCAT in (-3,1,2,8,3,4,9) then do;
ENCAT=5;
same_mth=1;
end;

if CDTBA>0 & doicm=CDTBA & ENCAT in (-3,1,2,8,3,4,5,10) then do;
ENCAT=6;
same_mth=1;
end;

if ((CDTMA>0 & doicm=CDTMA)|(CDTDC>0 & doicm=CDTDC)) & ENCAT~=7 then do;
ENCAT=7;
same_mth=1;
end;

** If R was enrolled since DLI although may not be currently enrolled;
if ENROLL=1|(ENROLL=0 & e3878r9~=0) then do;

* MISSING VALUES;
if lastsch=-3 & ENCAT<0 then do;
ENCAT=-3;
reason=1;
end;

if INV2=1 then do;
flagcoll=-3;
college=-3;
if enroll=1 & lastsch=2.3 then do;
ENCAT=-3;
reason=2.1;
end;
if enroll=0 & somecoll=0 & lastsch=2.3 then do;
ENCAT=-3;
reason=2.2;
end;
end;

* Those who completed high school (or a GED), report HGA>12 but do not identify a college.;
if (HSD=1|GED=1) & (13<=e2857r9<95) & (13<=e3112r9<95) then do;
tmpvar1=ENCAT;
tmpvar2=reason;
ENCAT=-3;
reason=3;
do i=1 to dim(scode);
if scode(i) in (-1,-2,-3,4,5,6) then do;
ENCAT=tmpvar1;
reason=tmpvar2;
end;
end;
end;

* If R has neither GED nor H.S. Diploma but reports going to a college, in a degree program,
& HGA>=13 - hand edit these cases if Rs are in a degree program;
if (13<=e2857r9<=20) & GED=0 & HSD=0 & clg_ok~=1 & currcoll=1 then do;
ENCAT=-3;
reason=5;
end;

* Those who reported being in a 2-yr or 4-yr college but were not asked what type of degree
working towards;
if rosprb1=1 & ENCAT=-3 & reason=. then reason=6;
end;

** HAND EDITS (2);
if pubid= 2122 then do;
ENCAT=1;
reason=7;
handedit=1;
end;
if pubid in (1642 5790 5879 7190 7687) then do;
HE9_EN=ENCAT;
ENCAT=6;
end;

if pubid= 6482 then do;
HE9_EN=ENCAT;
ENCAT=8;
end;
if pubid= 7465 then do;
HE9_EN=ENCAT;
ENCAT=-3;
end;
if pubid= 7481 then do;
HE9_EN=ENCAT;
ENCAT=8;
end;
if pubid= 8385 then do;
HE9_EN=ENCAT;
ENCAT=8;
end;
if pubid= 1561 then do;
HE9_EN=ENCAT;
ENCAT=1;
end;

** These are cases where Respondents
(1) graduated from high school with a high school diploma
(2) enrolled in a two-year or four-year college
(3) HGA>=13
(4) degree working towards is Don't Know
(5) In the next/previous round they report enrollment at this college and working towards a BA or AA
degree.
We assign them the college enrollment.;
if pubid in (759 1964 2932) then do;
HE5_EN=ENCAT;
ENCAT=9;
end;

** Not sure whether these Rs did receive a H.S. Diploma or not;
if pubid in (101 510 3098 4433 7725 7929 3793 4682 4999 5225
7179 8873 205 8114 8088 19 65 2810 1792) & ENCAT=3 then do;
HE9_EN=ENCAT;
ENCAT=-3;
end;
 

if pubid= 7391 & ENCAT=2 then do;
HE9_EN=ENCAT;
ENCAT=-3;
end;
if pubid in (6482 7632 3301 7743) then do;
HE9_EN=ENCAT;
ENCAT=2;
end;
if pubid= 331 then do;
HE9_EN=ENCAT;
ENCAT=9;
end;
if pubid in (6736 1843 6153) then do;
HE9_EN=ENCAT;
ENCAT=-3;
end;
if pubid in (2922 8459) then do;
HE9_EN=ENCAT;
ENCAT=3;
end;

oldENCAT=ENCAT;
oldenroll=enroll;

********************************************** SECTION II **********************************************;
** Must fix "ENROLL" flag because this flag is used in the grades skipped/repeated program;
if ENCAT in (1,2,3,4,5,6,7) & ENROLL~=0 then do;
ENROLL=0;
enr_chg=1;
end;
if ENCAT in (8,9,10,11) & ENROLL~=1 then do;
ENROLL=1;
enr_chg=2;
end;

** Arrays to be used in the rest of the program;
* Grades attended;
array gratnd (13) e8416r9_11 e8416r9_12 e8416r9_21 e8416r9_31
e9589r9_111-e9589r9_113 e9589r9_211-e9589r9_213
e9589r9_311-e9589r9_313;

* Grade completed;
array grcomp (13) e9131r9_11 e9131r9_12 e9131r9_21  e9131r9_31
e9946r9_111-e9946r9_113 e9946r9_211-e9946r9_213
e9946r9_311-e9946r9_313;

* start date - year;
array yrstrt (13) e8774yr9_11 e8774yr9_12  e8774yr9_21 e8774yr9_31
e9691yr9_111-e9691yr9_113 e9691yr9_211-e9691yr9_213
e9691yr9_311-e9691yr9_313;

* start date - month;
array mostrt (13) e8774mr9_11 e8774mr9_12  e8774mr9_21 e8774mr9_31
e9691mr9_111-e9691mr9_113 e9691mr9_211-e9691mr9_213
e9691mr9_311-e9691mr9_313;

* Date of completion - year;
array yrcomp (13) e9335yr9_11 e9335yr9_12  e9335yr9_21 e9335yr9_31
e10099yr9_111-e10099yr9_113 e10099yr9_211-e10099yr9_213
e10099yr9_311-e10099yr9_313;

* Date of completion - month;
array mocomp (13) e9335mr9_11 e9335mr9_12  e9335mr9_21 e9335mr9_31
e10099mr9_111-e10099mr9_113 e10099mr9_211-e10099mr9_213
e10099mr9_311-e10099mr9_313;

array e23450 (4) e23450r9_1-e23450r9_4;
array e27337 (4) e27337r9_1-e27337r9_4;
array scode (4) scoder9_1-scoder9_4;

maxgrade=-16;
comp_mo=-16;
comp_yr=-16;

evrloop=0; * Flag to indicate respondents who go through a grade loop at least once;
subsitm=0; * Flag to indicate e3112 (single item) is being used to compute GRSURV;
subhgam=0; * Flag to hgaloop (HGA from loop) minus 1 is being used to compute GRSURV;
subprev=0; * Flag to indicate grade from last interviewed round is being used to compute GRSURV;
setto12=0; * Flag to indicate GRSURV being set to 12;

dateitm=0; * Flag to indicate date of grade completion missing;
disagre=0; * Flag to indicate that GRSURV from previous rounds is greater than from the current round;
datedeg=0; * Flag to indicate date of degree received is invalid;
mxg_inv=0; * Flag to indicate that the completed grade from loops is 0 or invalid;

********************************************************************************************************
*** [II] CREATED VARIABLE - HIGHEST GRADE COMPLETED AS OF THE SURVEY DATE (GRSURV) ***
********************************************************************************************************;

*** [IIA] Enrolled or not enrolled;
** Compute maximum grade completed using information in this round (grade loops);
do i=1 to dim(gratnd);
if gratnd(i)>=0 & gratnd(i)>maxgrade then do;
if grcomp(i)=1 then do;
maxgrade=gratnd(i);
comp_mo=mocomp(i);
comp_yr=yrcomp(i);
end;
if grcomp(i) in (-1,-2,-3) then mxg_inv=1; *maxgrade=grcomp(i);
end;

** If the grade attended is not valid;
if gratnd(i) in (0,-1,-2,-3,-4) then do;
if grcomp(i)=1 then do;
mxg_inv=2;
maxgrade=-55;
end;
if grcomp(i) in (-1,-2,-3) then mxg_inv=3;
end;
if grcomp(i)>-4 then evrloop=1;
end;

do i=1 to dim(gratnd);
if gratnd(i)>=0 & gratnd(i)>CJUGR then do;
if grcomp(i)=1 then do;
if (0<yrcomp(i)<YEAR)|(yrcomp(i)=YEAR & 0<mocomp(i)<=MONTH) then do;
CJUMON=mocomp(i);
CJUYR=yrcomp(i);
CJUGR=gratnd(i);
GRMON=gratnd(i);
GRAUG=gratnd(i);
LOC=1000.1;
LOCA=1000.1;
end;
end;
end;
end;

** If same grade is reported more than once.;
do i=1 to dim(gratnd);
if gratnd(i)>=0 & gratnd(i)=maxgrade & grcomp(i)=1 then do;
if comp_yr>0 & comp_mo<0 & mocomp(i)>0 & comp_yr=yrcomp(i) then do;
comp_mo=mocomp(i);
end;
if comp_yr<0 & mocomp(i)>0 & yrcomp(i)>0 then do;
comp_mo=mocomp(i);
comp_yr=yrcomp(i);
end;
if comp_yr>0 & comp_mo>0 & mocomp(i)>0 & yrcomp(i)>0
& (comp_yr~=yrcomp(i)|comp_mo~=mocomp(i))
then do;
if yrcomp(i)>comp_yr then do;
comp_mo=mocomp(i);
comp_yr=yrcomp(i);
end;
if yrcomp(i)=comp_yr & mocomp(i)>comp_mo then do;
comp_mo=mocomp(i);
end;
end;
end;
end;

** If one grade is completed in September of YEAR and the next grade also starts in September of YEAR.;
do i=1 to dim(gratnd);
if maxgrade>=0 & comp_mo=9 & comp_yr=YEAR & gratnd(i)=maxgrade+1 & mostrt(i)=9 & yrstrt(i)=YEAR
then do;
CJUMON=8;
CJUYR=YEAR;
CJUGR=maxgrade;
GRMON=maxgrade;
GRAUG=maxgrade;
LOC=1.6;
LOCA=1.6;
end;
end;

** Make GRSURV equal to maximum completed grade reported in the loops;
GRSURV=maxgrade;
LOCATOR=1;

** R reports YSCH-3112 to be in (1,2,3,4) and as being in college;  R is reporting the
completed years of college rather than years of schooling. Here we identify these cases;
if ENCAT in (4,5,6,7,9,10,11) & e3112r9 in (1,2,3,4,5,6) then do;
inclg_lowHGC=1;
e3112r9_imp=e3112r9+12;
end;

** If invalid or incorrect grade data was read into loop or if R never goes through the loops and
they attended school at some time either at DLI or SDLI, then replace GRSURV with single item;
if (GRSURV=-55|evrloop=0) & e3878r9~=0 & e3112r9~=-4 then do;
subsitm=1;
if clg_ok~=1 then do;
GRSURV=e3112r9;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOCATOR=2.1;
LOC=2.11;
LOCA=2.11;
if CJUGR>0 & CJUMON<=MONTH & CJUYR=YEAR then do;
GRMON=CJUGR;
GRAUG=CJUGR;
LOC=2.12;
LOCA=2.12;
end;
end;
if GED=1 & hsrP=-4 & gdrP=-4 & attsch=0 & e3112r9=12 then do;
GRSURV=grsurvP;
GRMON=grsurvP;
GRAUG=grsurvP;
LOCATOR=2.21;
LOC=2.21;
LOCA=2.21;
end;
if HSD=1 & hsrP=-4 & gdrP=-4 & attsch=0 & e3112r9=12 then do;
GRSURV=grsurvP;
GRMON=grsurvP;
GRAUG=grsurvP;
LOCATOR=2.22;
LOC=2.22;
LOCA=2.22;
end;
end;

** If R confirmed completing a grade in the loop & didn't know the year of completion, then
use the loop data or the single item (ysch-3112) whichever is lower.;
if maxgrade=GRSURV & comp_yr=-2 then do;
if maxgrade>e3112r9 & e3112r9>=0 then do;
dateitm=1;
subsitm=1;
GRSURV=e3112r9;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOCATOR=3;
LOC=3.1;
LOCA=3.1;
end;
end;

if maxgrade=GRSURV & comp_yr~=-2 & comp_mo=-2 then do;
if comp_yr<YEAR then do;
GRMON=GRSURV;
GRAUG=GRSURV;
LOC=3.21;
LOCA=3.21;
end;
if comp_yr>=YEAR then do;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOC=3.22;
LOCA=3.22;
end;
end;

else if (comp_yr~=-2 & comp_mo~=-2) then do;
dateitm=.;
end;

** If R was enrolled SDLI but didn't confirm completing a grade.  If single item HGA and HGA from the
loop are equal then substitute HGC single item if HGA from the loop is higher or equal to the HGC single
item. If GRSURV still cannot be assigned then we use the expected date of graduation and HGC single
item to ascertain if the HGC single item could be correct (and use it).  If GRSURV still cannot be
assigned then we use HGC at DLI if that is greater than the HGC single item.;
if GRSURV=-16 & e3878r9~=0 & evrloop=1 then do;
if hgaloop=e2857r9 & e2857r9>=0 & e3112r9>=0 then do;
if hgaloop=e3112r9|hgaloop=e3112r9+1 then do;
gr_ncomp1=1;
subsitm=1;
GRSURV=e3112r9;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOCATOR=4.11;
LOC=4.11;
LOCA=4.11;
if gdrP=-4 & GED=1 & e3112r9=12 then do;
GRSURV=grsurvP;
LOCATOR=4.12;
end;
if 0<=e3112r9<GRSURVP then gr_ncomp1=2;
end;
if 0<=GRSURVP<hgaloop<e3112r9 then do;
GRSURV=grsurvP;
GRMON=grsurvP;
GRAUG=grsurvP;
LOCATOR=4.13;
LOC=4.13;
LOCA=4.13;
end;
if hgaloop>e3112r9+1 & e3112r9>GRSURVP>=0 then gr_ncomp1=3;
if hgaloop>e3112r9+1 & 0<=e3112r9<GRSURVP then gr_ncomp1=4;
if hgaloop<e3112r9 & 0<=GRSURVP<=e3112r9 then gr_ncomp2=1;
if hgaloop<e3112r9 & 0<=e3112r9<GRSURVP then gr_ncomp2=2;
end;
if hgaloop~=e2857r9 & e2857r9>=0 & hgaloop>=0 then do;
if hgaloop<e2857r9 then gr_ncomp3=1;
if hgaloop>e2857r9 then gr_ncomp3=2;
end;
end;

if GRSURV=-16 & e3878r9~=0 & evrloop=1 & doicm>0 & gradcm>0 & 0<e3112r9<=12 then do;
if e3112r9=12 & gradcm=doicm then do;
GRSURV=12;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOCATOR=4.21;
LOC=4.21;
LOCA=4.21;
end;
if e3112r9=12 & gradcm<=doicm+5 & ((gradcm=((intyr9-1980)*12)+5)|(gradcm=((intyr9-1980)*12)+6))
then do;
GRSURV=12;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOCATOR=4.22;
LOC=4.22;
LOCA=4.22;
end;
* Not enrolled;
if e24889mr9=-4 then do;
if intmr9<8 & (e3112r9=11 & gradyr9=intyr9+1) or (e3112r9=10 & gradyr9=intyr9+2)
or (e3112r9=9 & gradyr9=intyr9+3) or (e3112r9=8 & gradyr9=intyr9+4)
or (e3112r9=7 & gradyr9=intyr9+5) then do;
GRSURV=e3112r9;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOCATOR=4.23;
LOC=4.23;
LOCA=4.23;
end;
if intmr9>=8 & (e3112r9=11 & gradyr9=intyr9+2) or (e3112r9=10 & gradyr9=intyr9+3)
or (e3112r9=9 & gradyr9=intyr9+4) or (e3112r9=8 & gradyr9=intyr9+5)
or (e3112r9=7 & gradyr9=intyr9+6) then do;
GRSURV=e3112r9;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOCATOR=4.24;
LOC=4.24;
LOCA=4.24;
end;
end;
* Enrolled;
if e24940mr9=-4 then do;
if intmr9<5 & ((e2857r9=e3112r9+1)|(hgaloop=e3112r9+1))
& (e3112r9=11 & gradyr9=intyr9+0) or (e3112r9=10 & gradyr9=intyr9+1)
or (e3112r9=9 & gradyr9=intyr9+2) or (e3112r9=8 & gradyr9=intyr9+3)
or (e3112r9=7 & gradyr9=intyr9+4) then do;
GRSURV=e3112r9;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOCATOR=4.25;
LOC=4.25;
LOCA=4.25;
end;
if 5<=intmr9<8 & ((e2857r9=e3112r9)|(hgaloop=e3112r9))
& (e3112r9=11 & gradyr9=intyr9+1) or (e3112r9=10 & gradyr9=intyr9+2)
or (e3112r9=9 & gradyr9=intyr9+3) or (e3112r9=8 & gradyr9=intyr9+4)
or (e3112r9=7 & gradyr9=intyr9+5) then do;
GRSURV=e3112r9;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOCATOR=4.26;
LOC=4.26;
LOCA=4.26;
end;
if intmr9>=8 & ((e2857r9=e3112r9+1)|(hgaloop=e3112r9+1))
& (e3112r9=11 & gradyr9=intyr9+1) or (e3112r9=10 & gradyr9=intyr9+2)
or (e3112r9=9 & gradyr9=intyr9+3) or (e3112r9=8 & gradyr9=intyr9+4)
or (e3112r9=7 & gradyr9=intyr9+5) then do;
GRSURV=e3112r9;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOCATOR=4.27;
LOC=4.27;
LOCA=4.27;
end;
end;
end;

if GRSURV=-16 & e3878r9~=0 & evrloop=1 then do;
if 0<=e3112r9<=grsurvP then do;
GRSURV=grsurvP;
GRMON=grsurvP;
GRAUG=grsurvP;
LOCATOR=4.3;
LOC=4.3;
LOCA=4.3;
end;
end;

** If college attendance is not reported in the loops then use should be made of the single item HGC
(e3112), but only if enrollment in a college degree program is reported in the current or previous
round. Use ENCAT to determine whether R was ever in college. Given that R attends college then
(a) if e3112>=12 then set that.
(b) if R reports not attending college in this round but had attended college by DLI then set
to HGC by DLI.
(c) otherwise if e3112<12 and none of the above conditions hold then it is unclear what HGC is so
HGC=-3. Check these cases carefully, using comments to see whether R was actually enrolled in
a degree program in college. If so then leave those cases out.;

if ENCAT in (4,5,6,7,9,10,11) then do;
if 12<e3112r9<95 then do;
subsitm=1;
GRSURV=e3112r9;
LOCATOR=5.11;
end;
if e3112r9=12 & LOCATOR not in (2.21,2.22) then do;
subsitm=1;
GRSURV=e3112r9;
LOCATOR=5.12;
end;
if 0<=e3112r9<12 then do;
inclg_lt12=1;
subsitm=1;
GRSURV=e3112r9;
if e3112r9_imp>12 then GRSURV=e3112r9_imp;
LOCATOR=5.2;
end;
if GED=1 & e3112r9=12 then do;
if maxgrade>=0 then do;
GRSURV=maxgrade;
LOCATOR=5.3;
end;
if maxgrade<0 then do;
GRSURV=grsurvP;
LOCATOR=5.4;
end;
end;
if currcoll=1 & 0<=grsurvP<95 & 0<=e3112r9<95 then inclgCI_grchg=e3112r9-grsurvP;
if currcoll=0 & prevcoll=1 & encatP in (4,5,6,7,9,10,11) & 0<=grsurvP<95 & 0<=e3112r9<95
then inclgDLI_grchg=e3112r2-grsurvP;
end;

** If R reports completing a grade in a previous round that is greater than GRSURV for the current
round and the single item provides a more consistent grade, the single item is used. If the
single item is also inconsistent, then GRSURV value from the previous round is used.
Note: don't use single item if it is greater than 12 and no college is reported;
if 0<grsurvP<95 & 0<GRSURV<grsurvP then disagre=1;

if disagre=1 & (hsrP>-4|gdrP>-4) & GRSURV<12 & grsurvP>=12 then do;
disagre=0.5;
subsprev=1;
GRSURV=grsurvP;
GRMON=grsurvP;
GRAUG=grsurvP;
LOCATOR=6.10;
LOC=6.10;
LOCA=6.10;
end;

if disagre=1 then do;
rnd_dif=(YEAR-1996)-dli_rnd+1;
sitm_pr=e3112r9-grsurvP;
if ENCAT in (1,8,-3) then do;
if ENCAT=-3 then do;
GRSURV=-3;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOCATOR=6.11;
LOC=6.11;
LOCA=6.11;
end;
if 0<=e3112r9<=12 & (0<=sitm_pr<=rnd_dif|grsurvP=95) then do;
subsitm=1;
GRSURV=e3112r9;
LOCATOR=6.12;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOC=6.12;
LOCA=6.12;
end;
end;

if 12<=grsurvP<95 & ENCAT in (4,5,6,7,9,10,11) & currcoll=1 then do;
GRSURV=grsurvP;
subprev=1;
LOCATOR=6.21;
if 0<=sitm_pr<=rnd_dif then do;
subsitm=1;
GRSURV=e3112r9;
LOCATOR=6.22;
end;
if e3112r9_imp>grsurvP then do;
GRSURV=e3112r9_imp;
LOCATOR=6.23;
end;
end;
end;

if 0<GRSURV<grsurvP<=12 then do;
disagre=2;
if expcurrgr=grsurvP then do;
GRSURV=grsurvP;
GRMON=grsurvP;
GRAUG=grsurvP;
LOCATOR=6.31;
LOC=6.31;
LOCA=6.31;
end;
if expcurrgr=grsurvP+1 & expcurrgr>GRSURV+1 then do;
GRSURV=grsurvP;
GRMON=grsurvP;
GRAUG=grsurvP;
LOCATOR=6.32;
LOC=6.32;
LOCA=6.32;
end;
end;

if 0<grsurvP<95 & 0<GRSURV<grsurvP then do;
disagre=3;
end;

*** [IIB] If not enrolled SDLI;
** Assign previous HGC. If previous HGC is missing, then assign single item (e3112).;
* Note for USER'S GUIDE: every R who reports not being enrolled SDLI is given the HGC at DLI except
for those who report receiving a H.S. Diploma during the interim. The latter are assigned a
highest grade completed of 12. Some of these Rs who were not enrolled SDLI report HGC higher than
HGC from last interview. We do not use this new information for the computation of their HGC as
this information is not consistent.;

if e3878r9=0 & grsurvP>=0 then do;
subprev=1;
GRSURV=grsurvP;
GRMON=grsurvP;
GRAUG=grsurvP;
LOCATOR=7.1;
LOC=7.1;
LOCA=7.1;
end;
if e3878r9=0 & grsurvP<=0 then do;
subsitm=1;
GRSURV=e3112r9;
GRMON=-3;
if e3112r9<=12|e3112r9=95 then GRAUG=-3;
LOCATOR=7.2;
LOC=7.2;
LOCA=7.2;
end;

if 12<GRSURV<95 & ENCAT in (1,2,3,8,-3) then do;
whyover12=1;
end;

if GRSURV=-16 then do;
GRSURV=-3;
GRMON=-3;
GRAUG=-3;
LOCATOR=8.1;
LOC=8.1;
LOCA=8.1;
end;

if GRSURV in (-55,-2,0) then do;
GRSURV=-3;
GRMON=-3;
GRAUG=-3;
LOCATOR=8.2;
LOC=8.2;
LOCA=8.2;
end;

if (hsrP>-4|gdrP>-4) & GRSURV~=grsurvP & 0<GRSURV<12 then do;
if evrloop=0 & grsurvP=grsurvP_no3061 then do;
GRSURV=grsurvP;
GRMON=grsurvP;
GRAUG=grsurvP;
LOCATOR=9.1;
LOC=9.1;
LOCA=9.1;
end;
if evrloop~=0|grsurvP~=grsurvP_no3061 then do;
LOCATOR=9.2;
end;
end;

if GRMON=. then do;
GRMON=-3;
GRAUG=-3;
LOC=9.3;
LOCA=9.3;
end;
if GRMON=-3 then do;
if maxgrade=GRSURV & grsurvP=GRSURV-1 & ((comp_yr=YEAR & comp_mo>MONTH)|comp_yr>YEAR)
& 0<dlicm<MONYR then do;
GRMON=grsurvP;
GRAUG=grsurvP;
LOC=10.1;
LOCA=10.1;
end;
end;
if GRMON=-3 & GRSURV>0 then do;
do i=1 to dim(gratnd);
if GRSURV=gratnd(i)-1 & ((0<yrstrt(i)<YEAR)|(yrstrt(i)=YEAR & 0<mostrt(i)<=MONTH+1)) then do;
GRMON=GRSURV;
GRAUG=GRSURV;
LOC=10.2;
LOCA=10.2;
i=dim(gratnd);
end;
end;
end;
if GRMON=-3 & GRSURV>0 & CJUGR>0 then do;
do i=1 to dim(gratnd);
if CJUGR=gratnd(i)-1 & ((0<yrstrt(i)<YEAR)|(yrstrt(i)=YEAR & 0<mostrt(i)<=MONTH+1)) then do;
GRMON=CJUGR;
GRAUG=CJUGR;
LOC=10.3;
LOCA=10.3;
i=dim(gratnd);
end;
end;
end;
if GRMON=-3 & GRSURV>0 then do;
if 0<STOP<MONYR & sch in (1,2,3) then do;
GRMON=GRSURV;
GRAUG=GRSURV;
LOC=10.4;
LOCA=10.4;
end;
end;
if GRMON=-3 then do;
if maxgrade=GRSURV & grsurvP=GRSURV-2 & ((comp_yr=YEAR & comp_mo>MONTH)|comp_yr>YEAR)
& 0<dlicm<MONYR then do;
GRMON=grsurvP;
GRAUG=grsurvP;
LOC=10.5;
LOCA=10.5;
end;
end;

** When we use the single item (YSCH-3112) to get GRSURV we are unable to verify whether the date of
completion for this grade was by Aug of 1999 and so we give a -3 for GRMON. However,
(1) if these are diff1gr cases and we find that maxgrade=YSCH-3112 and the date of completion
of this grade (maxgrade) is by Aug of 1999 then we can assign YSCH-3112 (=maxgrade) to be
GRMON
(2) if the date of grade completion (from loops) is Aug of 1998 be almost sure that the person
could not have completed another grade in that year and so take GRMON to be that grade
completed on Aug of 1998. Note: This situation arises only for diff1gr cases;

if GRMON=-3 & ((0<comp_mo<=MONTH & comp_yr=YEAR)|0<comp_yr<YEAR) & GRSURV=e3112r9 & e3112r9=maxgrade
then do;
GRMON=maxgrade;
GRAUG=maxgrade;
LOC=11.1;
LOCA=11.1;
end;
if GRMON=-3 & comp_mo=MONTH & comp_yr=YEAR & GRSURV=e3112r9 & maxgrade>0 then do;
GRMON=maxgrade;
GRAUG=maxgrade;
LOC=11.2;
LOCA=11.2;
end;

** If GRSURV is coded with the GRSURV at DLI, (grsurvP) then we must check whether that grade
was completed by Aug of 1999 before coding GRMON=grsurvP.;
if GRSURV=grsurvP then do;
if GRMON~=grsurvP then do;
GRMON=grsurvP;
GRAUG=grsurvP;
LOC=12.1;
LOCA=12.1;
end;
end;
if GRMON=grsurvP then do;
if doicm_LR>MONYR then do;
GRMON=-3;
GRAUG=-3;
chk_grmon=1;
LOC=12.2;
LOCA=12.2;
end;
if grsurvP=maxgrade_LR & comp_yr_LR=YEAR & comp_mo_LR>MONTH then do;
GRMON=-3;
GRAUG=-3;
chk_grmon=2;
LOC=12.3;
LOCA=12.3;
end;
if grsurvP=12 & (cdths>MONYR>0) then do;
GRMON=-3;
GRAUG=-3;
chk_grmon=.;
LOC=12.4;
LOCA=12.4;
end;
end;

** If R received HS Diploma or GED before MONYR of last round, it means that R has completed
high school by that time and so GRMON should reflect the highest grade completed by that time.;
if hsrP>-4|gdrP>-4 then do;
if 0<=grsurvP<=12 & GRMON<grsurvP then do;
subprev=1;
GRMON=grsurvP;
GRAUG=grsurvP;
LOC=13.11;
LOCA=13.11;
end;
end;
if ((0<hsrP<=(MONYR-12))|(0<gdrP<(MONYR-12))) & GRMON<grmonP then do;
if 0<=grmonP<=12 then do;
subprev=1;
GRMON=grmonP;
GRAUG=graugP;
LOC=13.12;
LOCA=13.12;
end;
if grsurvP<0 & grmonP<0 then do;
GRMON=-3;
GRAUG=-3;
LOC=13.13;
LOCA=13.13;
end;
end;

** Here we have put in checks to verify that those who are attending college receive GRMON=-4.;
if ENCAT in (4,5,6,7,9,10,11)|(encatP in (4,5,6,7,9,10,11) & ENCAT=-3) then do;
GRMON=-4;
LOC=13.2;
end;
 

** If R reports a HGC>12 but R is not in a college-degree program we assign the HGC in highschool
as the HGC received.;
if ENCAT in (1,2,3,8,-3) & e3112r9~=-5 then do;
if 12<GRSURV<95|(12<e3112r9<95 & GRSURV=-3) then do;
whyover12=1;
if 0<maxgrade<=12 then do;
GRSURV=maxgrade;
LOCATOR=13.31;
if GRSURV=grsurvP then do;
GRMON=grsurvP;
GRAUG=grsurvP;
LOC=13.31;
LOCA=13.31;
end;
end;
if (12<GRSURV<95 & 0<grsurvP<=12)|(GRSURV<grsurvP & 0<grsurvP<=12) then do;
GRSURV=grsurvP;
GRMON=grsurvP;
GRAUG=grsurvP;
LOCATOR=13.42;
LOC=13.42;
LOCA=13.42;
end;
if (12<GRSURV<95 & 0<grsurvP_no3061<=12)|(GRSURV<grsurvP_no3061 & 0<grsurvP_no3061<=12) then do;
GRSURV=grsurvP_no3061;
GRMON=grsurvP_no3061;
GRAUG=grsurvP_no3061;
LOCATOR=13.5;
LOC=13.5;
LOCA=13.5;
end;
if (12<GRSURV<95 & 0<e3112r9<=12)|(GRSURV<e3112r9 & 0<e3112r9<=12) then do;
GRSURV=e3112r9;
GRMON=-3;
GRAUG=-3;
LOCATOR=13.6;
LOC=13.61;
LOCA=13.61;
if GRSURV=grsurvP then do;
GRMON=grsurvP;
GRAUG=grsurvP;
LOC=13.62;
LOCA=13.62;
end;
if GRSURV=grsurvP_no3061 then do;
GRMON=grsurvP_no3061;
GRAUG=grsurvP_no3061;
LOC=13.63;
LOCA=13.63;
end;
end;
end;
end;
** Hand edit these cases;
if 12<GRSURV<95 & ENCAT in (1,2,3,8,-3) then do;
LOCATOR=13.7;
end;
if 12<GRMON<95 & ENCAT in (1,2,3,8,-3) then do;
LOC=13.7;
end;
if pubid in (1102) then do;
GRSURV=grsurvP;
GRMON=grsurvP;
HE9_GRS=1;
HE9_GRJ=1;
end;

** Hand edits determined using information from all rounds;
if pubid= 7442 then do;
GRSURV=14;
LOCATOR=15;
HE9_GRS=1;
end;
if pubid= 204 then do;
GRSURV=13;
LOCATOR=15;
HE9_GRS=1;
end;
if pubid= 323 then do;
GRSURV=grsurvP;
LOCATOR=15;
HE9_GRS=1;
end;
oldgrs9=GRSURV;
oldgrm9=GRMON;
if pubid in (807 3918 8268 1761 8448 3098 7828 4558 692 8477) then do;
GRSURV=-3;
LOCATOR=15;
HE9_GRS=2;
end;
if pubid= 2217 then do;
GRMON=-3;
LOC=15;
HE9_GRJ=2;
end;
if pubid in (5857 3373 1928 812 7929 7617 3656 27 1948 2142
5579 5995 6182 6345 8802 2217 4923 5447 5782 7607
3270 205 2143 2814 7008 8718 3178 8589 769 6663
7602 8491 8701 8701 8470 8725) then do;
GRSURV=-3;
GRMON=-3;
LOCATOR=15;
LOC=15;
HE9_GRS=2;
HE9_GRJ=2;
end;
if pubid in (8182) then do;
GRSURV=6;
GRMON=6;
LOCATOR=15;
LOC=15;
HE9_GRS=2;
HE9_GRJ=2;
end;
if pubid in (1706) then do;
GRSURV=7;
GRMON=7;
LOCATOR=15;
LOC=15;
HE9_GRS=2;
HE9_GRJ=2;
end;
if pubid in (4864 1428 3438 6645 701 6743 5927) then do;
GRSURV=8;
GRMON=8;
LOCATOR=15;
LOC=15;
HE9_GRS=2;
HE9_GRJ=2;
end;
if pubid in (257 8476 7529 1953) then do;
GRSURV=9;
GRMON=9;
LOCATOR=15;
LOC=15;
HE9_GRS=2;
HE9_GRJ=2;
end;
if pubid in (7349 5499 1260 8733 7848 2590 2590) then do;
GRSURV=10;
GRMON=10;
LOCATOR=15;
LOC=15;
HE9_GRS=2;
HE9_GRJ=2;
end;
if pubid in (6804 7033 6811 8862) then do;
GRSURV=11;
GRMON=11;
LOCATOR=15;
LOC=15;
HE9_GRS=2;
HE9_GRJ=2;
end;
if pubid in (4940 1626) then do;
GRSURV=12;
GRMON=12;
LOCATOR=15;
LOC=15;
HE9_GRS=2;
HE9_GRJ=2;
end;

/**********************/
** Create grsurvF;
if hsrP=-4 & (grsurvFP<12|grsurvFP=95) & (GRSURV<=12|GRSURV=95) then do;
grsurvF=GRSURV;
locF=1;
end;
if hsrP=-4 & (grsurvFP<12|grsurvFP=95) & 12<GRSURV<95 then do;
if (grsurvFP<maxgrade<=12)|(grsurvFP=95 & maxgrade<=12) then do;
grsurvF=maxgrade;
locF=2;
end;
if (maxgrade<=grsurvFP)|maxgrade>12 then do;
grsurvF=grsurvFP;
locF=3;
end;
end;
if hsrP>-4|grsurvFP=12 then do;
grsurvF=grsurvFP;
locF=4;
end;
if hsrP=-4 & grsurvFP<12 & ENCAT in (1,2,3,8,-3) then do;
grsurvF=GRSURV;
locF=5;
end;
if e3112r9=-5 then do;
grsurvF=grsurvFP;
locF=6;
end;

if pubid= 8338 then do;
grsurvF=-3;
locF=15;
end;
if pubid= 6857 then do;
grsurvF=10;
locF=15;
end;

** Create GRAUG;
if HE9_GRJ in (1,2) then do;
GRAUG=GRMON;
LOCA=15;
end;
if grsurvP=12 & GRSURV>=12 & GRAUG~=12 then do;
GRAUG=12;
LOCA=16;
end;
if grsurvP<=12 & GRSURV>=12 & evrloop=0 & (GRAUG=.|GRAUG=-3) & ENCAT in (4,5,6,7,9,10,11) then do;
GRAUG=grsurvP;
LOCA=17;
end;
if 12<grsurvP<95 then do;
GRAUG=graugP;
LOCA=18;
end;
if graugP=12 then do;
GRAUG=12;
LOCA=19;
end;

if LOCATOR~=15 then do;
if attsch=0 & e3878r9~=0 & 0<=e3112r9<=12 & 0<=grsurvP<GRSURV<=12 then do;
GRSURV=grsurvP;
GRAUG=GRSURV;
GRMON=GRSURV;
LOCATOR=20.1;
LOC=20.1;
LOCA=20.1;
if locF in (1,5) then do;
grsurvF=GRSURV;
locF=7;
end;
end;
if attsch=0 & e3878r9~=0 & 12<e3112r9<95 & 0<=grsurvP_no3061<GRAUG<=12 & grmonP=-4 then do;
GRAUG=grsurvP_no3061;
LOCA=20.2;
end;
end;

if pubid in (2848) then do;
GRAUG=12;
LOCA=15;
end;

if (ENCAT in (4,5,6,7,9,10,11)|(encatP in (4,5,6,7,9,10,11) & ENCAT=-3)) then do;
GRMON=-4;
end;

********************************************************************************************************
*** [IV] CREATED VARIABLE - HIGHEST DEGREE RECEIVED AS OF THE SURVEY DATE (DEGSURV) ***
********************************************************************************************************;
DEGSURV=0;

** GED;
if GED=1 then DEGSURV=1;
if GED=-3 then DEGSURV=-3;

** High School Diploma;
if HSD=1 then DEGSURV=2;
if HSD=-3 then DEGSURV=-3;

** Junior College or two-year Associate Degree;
if CDTAA>-4 then DEGSURV=3;

** Bachelor's Degree;
if CDTBA>-4 then DEGSURV=4;

** Master's Degree;
if CDTMA>-4 then DEGSURV=5;

** Doctoral Degree;
if CDTDC>-4 then DEGSURV=6;

** Professional Degree;
if CDTPF>-4 then DEGSURV=7;

** If degree received cannot determine what degree received;
do i=1 to dim(e23450);
if e23450(i) in (-1, -2, -3) then DEGSURV=-3;
end;

** Check these cases as they should not occur;
if 0<=DEGSURV<degsurvP then prev_deg=1;

** Not sure whether received a H.S. Diploma or not;
if pubid in (101 510 3098 4433 4999 7725 7929 3793 4682 7179
8873 205 8114 8088 19 65 2810) & DEGSURV=2 then do;
DEGSURV=-3;
HE9_DG=1;
end;
** Not sure whether received an AA or BA.;
if pubid in (311 5151 5620) then do;
DEGSURV=-3;
HE9_DG=1;
end;
** Not sure whether received a GED, a H.S.Diploma, both or none.;
if pubid= 7391 & DEGSURV=1 then do;
DEGSURV=-3;
HE9_DG=1;
end;

********************************************************************************************************
*** [V] CREATED VARIABLE - HIGHEST DEGREE COMPLETED AS OF JUNE 30, 2001 (DEGAUG) ***
********************************************************************************************************;
DEGAUG=0;
** GED;
if 0<CDTGD<=MONYR then DEGAUG=1;
if CDTGD in (-3, -2, -1) then DEGAUG=-3;

** High School Diploma;
if 0<CDTHS<=MONYR then DEGAUG=2;
if CDTHS in (-3, -2, -1) then DEGAUG=-3;

** Junior College or 2-year Associate Degree;
if 0<CDTAA<=MONYR then DEGAUG=3;
if CDTAA in (-3, -2, -1) then DEGAUG=-3;

** Bachelor's Degree;
if 0<CDTBA<=MONYR then DEGAUG=4;
if CDTBA in (-3, -2, -1) then DEGAUG=-3;

** Master's Degree;
if 0<CDTMA<=MONYR then DEGAUG=5;
if CDTMA in (-3, -2, -1) then DEGAUG=-3;

** Doctoral Degree;
if 0<CDTDC<=MONYR then DEGAUG=6;
if CDTDC in (-3, -2, -1) then DEGAUG=-3;

** Professional Degree;
if 0<CDTPF<=MONYR then DEGAUG=7;
if CDTPF in (-3, -2, -1) then DEGAUG=-3;

if DEGSURV=-3 then DEGAUG=-3;

** Making sure that those with invalid date of degree received dates also have invalid codes for
DEGAUG. However for those who received the degree by last interview, even if we do not know
those dates must be coded as having received that degree by MONTH of this round. Also, constrain
the highest degree received by MONTH of this round to the highest degree received by the
interview date of this round.;
if (DEGSURV=1 & -4<CDTGD<=0)|(DEGSURV=2 & -4<CDTHS<=0)|(DEGSURV=3 & -4<CDTAA<=0)
|(DEGSURV=4 & -4<CDTBA<=0)|(DEGSURV=5 & -4<CDTMA<=0)|(DEGSURV=6 & -4<CDTDC<=0)
|(DEGSURV=7 & -4<CDTPF<=0) then do;
datedeg=1;
DEGAUG=-3;
end;
** Constrain DEGAUG by prevdegsruv if the latter is equal to DEGSURV in this round;
if DEGAUG~=DEGSURV & DEGSURV=degsurvP & DEGSURV>=0 & DEGAUG>0 then do;
DEGAUG=degsurvP;
end;
if DEGAUG=-3 & DEGSURV=degsurvP & DEGSURV>=0 & 0<dlicm<MONYR then do;
DEGAUG=degsurvP;
end;

if ENCAT in (-1,-2) then ENCAT=-3;
if GRSURV in (-1,-2) then GRSURV=-3;
if GRMON in (-1,-2) then GRMON=-3;
if DEGSURV in (-1,-2) then DEGSURV=-3;
if DEGAUG in (-1,-2) then DEGAUG=-3;

if e3112r9=-5 then do;
ENROLL=-5;
ENCAT=-5;
GRSURV=-5;
GRMON=-5;
GRAUG=-5;
DEGSURV=-5;
DEGAUG=-5;
GED=-5;
HSD=-5;
LOCATOR=-5;
LOC=-5;
LOCA=-5;
end;

chk1=.; chk2=.; chk3=.; chk4=.; chk4z=.; chk5=.; chk6=.;

if ENCAT in (4,5,6,7,9,10,11) then do;
if 0<=grsurv<12 then chk1=1;
if grsurv=95 then chk1=2;
end;

if ENCAT in (1,2,3,8) then do;
if 12<grsurv<95 then chk2=1;
if grsurv=95 then chk2=2;
end;

if degsurv=0 & ENCAT in (2,3,4,5,6,7,9,10,11) then chk3=1;
if degsurv=1 & ENCAT in (1,8,3,5,6,7) then chk3=2;
if degsurv=2 & ENCAT in (1,8,2,5,6,7) then chk3=3;
if degsurv=3 & ENCAT in (1,8,2,3,6,7) then chk3=4;
if degsurv=4 & ENCAT in (1,8,2,3,5,7) then chk3=5;
if degsurv in (5,6,7) & ENCAT in (1,8,2,3,5,6) then chk3=6;

if 0<=e2857r9<grsurv<95 then do;
if 0<=e2857r9<grsurvP<95 & e3878r9~=0 then chk4=1.1;
if 0<=e2857r9<maxgrade<95 then chk4=1.2;
if 0<=e2857r9<e3112r9<95 then chk4=1.3;
if hsd=1 & grsurv=12 then chk4=.;
end;
if 0<=e2857r9<6 & ENCAT in (4,5,6,7,9,10,11) then z=e2857r9+12;
if z=. then chk4z=chk4;
if 0<=z<grsurv then do;
if 0<=z<grsurvP & e3878r9~=0 then chk4z=1.1;
if 0<=z<maxgrade then chk4z=1.2;
if 0<=z<e3112r9 then chk4z=1.3;
if hsd=1 & grsurv=12 then chk4z=.;
end;

if ENCAT=-3 & grsurv~=-3 then chk5=1;
if ENCAT~=-3 & grsurv=-3 & LOCATOR~=15 then chk5=2;
if ENCAT in (4,5,6,7,9,10,11) & currcoll=0 & 0<=grsurvP<grsurv & ever_24yrinst~=1 then chk6=1;

if (hsr6>-4|hsr5>-4|hsr4>-4|hsr3>-4|hsr2>-4) & CDTHS=-4 then chk7=1;
if (gdr6>-4|gdr5>-4|gdr4>-4|gdr3>-4|gdr2>-4) & CDTGD=-4 then chk8=1;

if comp_mo>0 & comp_yr>0 then comp_cms=((comp_yr-1980)*12)+comp_mo;

*** COMPUTE grmonr1;
** Compute grmonr1 using information in this round (grade loops);
if grmonr1=-16 then do;
** Select cases where there is a valid grade and it is greater than the previously recorded grade;
do i=1 to dim(gratnd);
if gratnd(i)>=0 & gratnd(i)>grmonr1 then do;
if grcomp(i)=1 then do;
if (0<yrcomp(i)<1997)|(yrcomp(i)=1997 & 0<mocomp(i)<=MONTH) then do;
if locR1~=. then do;
grmonr1x=grmonr1;
locR1x=locR1;
end;
cjumonr1=mocomp(i);
cjuyrr1=yrcomp(i);
grmonr1=gratnd(i);
locR1=1.1;
end;
end;
end;
end;
** If same grade is reported more than once.;
do i=1 to dim(gratnd);
if gratnd(i)>=0 & gratnd(i)=grmonr1 & grcomp(i)=1
& ((0<yrcomp(i)<1997)|(yrcomp(i)=1997 & 0<mocomp(i)<=MONTH)) then do;
if cjuyrr1>0 & cjumonr1<0 & mocomp(i)>0 & cjuyrr1=yrcomp(i) then do;
if locR1~=. then do; grmonr1x=grmonr1; locR1x=locR1; end;
cjumonr1=mocomp(i);
cjuyrr1=yrcomp(i);
grmonr1=gratnd(i);
locR1=1.2;
end;
if cjuyrr1<0 & mocomp(i)>0 then do;
if locR1~=. then do; grmonr1x=grmonr1; locR1x=locR1; end;
cjumonr1=mocomp(i);
cjuyrr1=yrcomp(i);
grmonr1=gratnd(i);
locR1=1.3;
end;
if cjuyrr1>0 & cjumonr1>0 & mocomp(i)>0 & (cjuyrr1~=yrcomp(i)|cjumonr1~=mocomp(i)) then do;
if yrcomp(i)>cjuyrr1 then do;
if locR1~=. then do; grmonr1x=grmonr1; locR1x=locR1; end;
cjumonr1=mocomp(i);
cjuyrr1=yrcomp(i);
grmonr1=gratnd(i);
locR1=1.4;
end;
if yrcomp(i)=cjuyrr1 & mocomp(i)>cjumonr1 then do;
if locR1~=. then do; grmonr1x=grmonr1; locR1x=locR1; end;
cjumonr1=mocomp(i);
cjuyrr1=yrcomp(i);
grmonr1=gratnd(i);
locR1=1.5;
end;
end;
end;
end;
if locR1=1.1 then do;
if intmr1=cjumonr1 & intyr1=cjuyrr1 & grmonr1=0 & grsurvr1>0 then do;
grmonr1=grsurvr1;
locR1=1.6;
end;
if intmr1=cjumonr1 & intyr1=cjuyrr1 & grmonr1=grsurvr1-1 & grsurvr1=GRMON-1 & grmonr1>0 then do;
grmonr1=grsurvr1;
locR1=1.7;
end;
if intmr1=cjumonr1 & intyr1=cjuyrr1 & grmonr1>0 & grsurvr1=0 then do;
grsurvr1=grmonr1;
locatorR1=2;
end;
if intyr1=cjuyrr1 & intyr1=1997 & 0<intmr1<=cjumonr1 & grsurvr1=e5000r1 & e5000r1>0
& e3061r9=e5000r1+1 & grmonr1=e3061r9+1 & grmonr1<=GRMON then do;
grmonr1=e3061r9;
locR1=1.8;
end;
if intyr1=cjuyrr1 & intyr1=1997 & 0<intmr1<=cjumonr1 & grsurvr1=e5000r1 & e5000r1>0
& e3061r9=e5000r1+2 & grmonr1=e3061r9 & grmonr1<=GRMON then do;
grsurvr1=e5000r1+1;
locatorR1=3;
end;
if intyr1=cjuyrr1 & intyr1=1997 & 0<intmr1<=cjumonr1 & grsurvr1=e5000r1 & e5000r1>0 & e3061r9=-4
& e3112r9=e5000r1+2 & grmonr1=GRMON & GRMON=e3112r9 & e3500r1=e5000r1+1 & e2857r9=e3112r9+1 then do;
grsurvr1=e5000r1+1;
locatorR1=4;
end;
end;
end;

if grmonr1=-16 & MAXGRADE-1=grsurvr1 & MAXGRADE>0 & grsurvr1>0 & doicmr1<213 & DOICM>212 then do;
if comp_yr>1997|(comp_mo>MONTH & comp_yr=1997) then do;
if locR1~=. then do; grmonr1x=grmonr1; locR1x=locR1; end;
grmonr1=grsurvr1;
locR1=2;
end;
end;

if grmonr1=-16 then do;
if doicmr1<213 & DOICM>212 & grsurvr1=GRSURV & grsurvr1>0 then do;
if locR1~=. then do; grmonr1x=grmonr1; locR1x=locR1; end;
grmonr1=grsurvr1;
locR1=3.1;
end;
if doicmr1>212 then do;
if locR1~=. then do; grmonr1x=grmonr1; locR1x=locR1; end;
grmonr1=grsurvr1;
locR1=4;
end;
end;

if encatr1 in (4,5,6,7,9,10,11) then do;
if locR1~=. then do; grmonr1x=grmonr1; locR1x=locR1; end;
grmonr1=-4;
locR1=6;
end;

if grsurvF=grsurvFP & grsurvFP>grsurvFr1>0 & locatorR1~=. & e3112r2=-5 & e3112r3=-5 & e3112r4=-5
& e3112r5=-5 & e3112r6=-5 & e3112r7=-5 & e3112r8=-5 then do;
grsurvFP=grsurvFr1;
grsurvF=grsurvFr1;
locF=8;
end;

if grsurvF>GRSURV>=0 then do;
checkthese=1;
if grsurvr8~=-5 & (0<GRSURV<=grsurvr8) then checkthese=0;
if grsurvr8=-5 & grsurvr7~=-5 & (0<GRSURV<=grsurvr7) then checkthese=0;
if grsurvr8=-5 & grsurvr7=-5 & grsurvr6~=-5 & (0<GRSURV<=grsurvr6) then checkthese=0;
if grsurvr8=-5 & grsurvr7=-5 & grsurvr6=-5 & grsurvr5~=-5 & (0<GRSURV<=grsurvr5) then checkthese=0;
if grsurvr8=-5 & grsurvr7=-5 & grsurvr6=-5 & grsurvr5=-5 & grsurvr4~=-5 & (0<GRSURV<=grsurvr4) then checkthese=0;
if grsurvr8=-5 & grsurvr7=-5 & grsurvr6=-5 & grsurvr5=-5 & grsurvr4=-4 & grsurvr3~=-5 & (0<GRSURV<=grsurvr3) then checkthese=0;
if grsurvr8=-5 & grsurvr7=-5 & grsurvr6=-5 & grsurvr5=-5 & grsurvr4=-4 & grsurvr3=-5 & grsurvr2~=-5 & (0<GRSURV<=grsurvr2) then checkthese=0;
if grsurvr8=-5 & grsurvr7=-5 & grsurvr6=-5 & grsurvr5=-5 & grsurvr4=-5 & grsurvr3=-5 & grsurvr2=-5 & (0<GRSURV<=grsurvr1) then checkthese=0;
end;
if grsurvFr1>grmonr1>=0 then checkthese=2;
if grsurvr1>GRSURV>=0 then checkthese=3;
if grmonr1>GRMON>=0 then checkthese=4;

ENDSAS;
 

Return to top


Current or Most Recent School Private or Parochial

Variables Created:  CV_SCHOOL_TYPE (SLTYPE)

Variables Used

Name in Program

Question Name in Data

 

Name in Program

Question Name in Data

TYPER1 CV_SCHOOL_TYPE_1997   SSTOP1Y2 NEWSCHOOL_STOP1.02~Y
TYPER2 CV_SCHOOL_TYPE_1998   SSTOP1M3 NEWSCHOOL_STOP1.03~M
TYPER3 CV_SCHOOL_TYPE_1999   SSTOP1Y3 NEWSCHOOL_STOP1.03~Y
TYPER4 CV_SCHOOL_TYPE_2000   SSTOP1M4 NEWSCHOOL_STOP1.04~M
TYPER5 CV_SCHOOL_TYPE_2001   SSTOP1Y4 NEWSCHOOL_STOP1.04~Y
TYPER6 CV_SCHOOL_TYPE_2002   SSTOP2M1 NEWSCHOOL_STOP2.01~M
TYPER7 CV_SCHOOL_TYPE_2003   SSTOP2Y1 NEWSCHOOL_STOP2.01~Y
TYPER8 CV_SCHOOL_TYPE_2004   SSTOP2M2 NEWSCHOOL_STOP2.02~M
SPERIOD1-4 NEWSCHOOL_PERIODS.01-.04   SSTOP2Y2 NEWSCHOOL_STOP2.02~Y
SCODE1-4 NEWSCHOOL_SCHCODE.01-.04   SSTOP3M1 NEWSCHOOL_STOP3.01~M
SSTOP1M1 NEWSCHOOL_STOP1.01~M   SSTOP3Y1 NEWSCHOOL_STOP3.01~Y
SSTOP1Y1 NEWSCHOOL_STOP1.01~Y   STYPE1-3 NEWSCHOOL_TYPE.01-.03
SSTOP1M2 NEWSCHOOL_STOP1.02~M   pubid PUBID

Codes for Created Variable

1 = Public school
2 = Private, not parochial 
3 = Parochial
4 = Other

This program is used to create the school type variables from Round 9, i.e. the current or most recent schools that the youth attended are public, private, parochial or other. This is completed in the following steps:

1) We first decide which school is the most recent school (non-college) that the youth participated by the ending date for different enrollment periods.
2) We can get the school type from the new school roster. However, in the program, these two steps can not be separated.


/* create the array variables.*/

* # of enrollment periods;
array speriod speriod1-speriod4;

* ending date for each period;
array sstop1m sstop1m1-sstop1m4;
array sstop1y sstop1y1-sstop1y4;
array sstop2m sstop2m1-sstop2m2;
array sstop2y sstop2y1-sstop2y2;
array sstop3m sstop3m1 sstop3m2;
array sstop3y sstop3y1 sstop3y2;

* school code, i.e. elementary school, high school or college;
array scode scode1-scode4;

*school type for round 8;
array stype stype1-stype4;

* ending time for each school;
array srecm srecm1-srecm4;
array srecy srecy1-srecy4;

* school length counting both month&year: the month length from Jan. 1990 to the ending month for each school;
array mlength mlength1-mlength4;

* school length counting only year: the year length from 1990 to the ending year for each school;
* this variable is to take care of the situation where ending year is invalid;
array ylength ylength1-ylength4;

/************************* step 1).In the process to decide the most recent school. ************************/
do i=1 to 4;
srecm[i]=-4;
srecy[i]=-4;
if speriod[i]=1 and scode[i] in (1,2,3) then do;
srecm[i]=sstop1m[i];
srecy[i]=sstop1y[i];
end;
if speriod[i]=2 and scode[i] in (1,2,3) then do;
srecm[i]=sstop2m[i];
srecy[i]=sstop2y[i];
end;
if speriod[i]=3 and scode[i] in (1,2,3) then do;
srecm[i]=sstop3m[i];
srecy[i]=sstop3y[i];
end;
if srecm[i] gt 0 and srecy[i] gt 0 then mlength[i]=12*(srecy[i]-1990)+srecm[i];
else mlength[i]=-4;
if srecy[i] gt 0 then ylength[i]=srecy[i]-1990;
else ylength[i]=-4;
end;

maxmleng=max(mlength1,mlength2, mlength3, mlength4);
if stype1=-5 then maxmleng=-5;

maxyleng=max(ylength1,ylength2, ylength3, ylength4);
if stype1=-5 then maxyleng=-5;

/************** step 2). Decide the latest non-college school and its type*************/
type1=-4;

***** create the flag variables;
* flag the cases where multiple schools' ending year/month are same as "maxmleng";
maxmeq=0;
do i=1 to 4;
if maxmleng>0 and mlength[i]=maxmleng then maxmeq=maxmeq+1;
end;

* flag the cases where multiple schools' ending year are the same as "maxyleng" and ending months are invalid answer;
invalidm=0; maxyeq=0;
do i=1 to 4;
if maxyleng>0 and ylength[i]=maxyleng and srecm[i] in (-1,-2,-3) then invalidm=invalidm+1;
if maxyleng>0 and ylength[i]=maxyleng then maxyeq=maxyeq+1;
end;

***** first step to create school type;
* use only the year information first;
do i=1 to 4;
if maxyleng>0 and ylength[i]=maxyleng then type1=stype[i];
end;

* then use the month information to make it more precise;
do i=1 to 4;
if maxmleng>0 and mlength[i]=maxmleng then type1=stype[i];
end;

***** Fix the special cases where multiple schools' ending years are same as maxyleng;
/* go back to fix the case such as 97.12 and 99.-2. because if "maxmleng" cover "maxyleng", the codes above
will pick up the school ending on 97.12 as most recent school.*/
if maxyeq=1 then do;
do i=1 to 4;
if ylength[i]=maxyleng then type1=stype[i];
end;
end;

if invalidm ge 2 then type1=-3;

* flag the cases which has 98.02 and 98.-3;
flag=0;
if maxyeq ge 2 and invalidm ge 1 then flag=1;

if flag=1 then type1=-3;

* fix the case such as 99.12, 99.-2 99.-3 or 2000.12 2000.-2;
if maxyeq ge 2 then do;
do i=1 to 4;
if ylength[i]=maxyleng and srecm[i]=12 then do;
type1=stype[i];
flag2=1;
end;
end;
end;

***** Fix the special cases where multiple schools ending year/months are same as maxmleng;
/*This loop assigns value of PUBLIC schools (1) to TYPE1 in cases where one reported school type=public
and one reported school type="other". In cases where one reported school type=PRIVATE and one reported
type="other", value for PRIVATE school type is assigned. Cases where one school type=PUBLIC and another
school type=PRIVATE are flagged and looked into. */

*dummy for one school is public school and the other is religious school;
pubrelg=0;
*dummy for one school is public school and the other is private school;
pubpriv=0;
*dummy for one school is private and the other is religious school;
privrelg=0;

if maxmeq ge 2 then do;
do i=1 to 4;
if mlength(i)=maxmleng and stype(i)^=type1 then do;
if stype(i) in (6,9,10,11,-1,-2,-3) and type1 in (1,2,12,13) then type1=type1;
if stype(i) in (1,2,12,13) and type1 in (6,9,10,11,-1,-2,-3) then type1=stype[i];
if stype(i) in (6,9,10,11,-1,-2,-3) and type1 in (3,4) then type1=type1;
if stype(i) in (3,4) and type1 in (6,9,10,11,-1,-2,-3) then type1=stype[i];
if stype(i) in (6,9,10,11,-1,-2,-3) and type1=5 then type1=5;
if stype(i)=5 and type1 in (6,9,10,11,-1,-2,-3) then type1=5;
if (stype(i) in (1,2,12,13) and type1 in (3,4)) or
(stype(i) in (3,4) and type1 in (1,2,12,13)) then pubrelg=1;
if (stype(i) in (1,2,12,13) and type1=5) or
(stype(i)=5 and type1 in (1,2,12,13)) then pubpriv=1;
if (stype(i)=5 and type1 in (3,4)) or
(stype(i) in (3,4) and type1=5) then privrelg=1;
end;
end;
end;

***** Invalid answers;
* for the invalid answers;
if scode1 in (-1,-2,-3)
or scode2 in (-1,-2,-3)
or scode3 in (-1,-2,-3)
or scode4 in (-1,-2,-3)
then type1=-3;

if (scode1 in (1,2,3) and srecy1 in (-1,-2,-3))
or (scode2 in (1,2,3) and srecy2 in (-1,-2,-3))
or (scode3 in (1,2,3) and srecy3 in (-1,-2,-3))
or (scode4 in (1,2,3) and srecy4 in (-1,-2,-3))
then type1=-3;

* if the respondent only goes to one school in r9,input that school type;
if scode1 in (1,2,3)
and scode2 in (-4, 4, 5)
and scode3 in (-4, 4, 5)
and scode4 in (-4, 4, 5)
then type1=stype1;

/******************************* recode the type variable.*************************************/
sltype=-4;
if type1 in (1,2,12,13) then sltype=1;
if type1=5 then sltype=2;
if type1 in (3,4) then sltype=3;
if type1 in (6,9,10,11) then sltype=4;
if -4<type1<0 then sltype=-3;
if stype1=-5 then sltype=-5;

* Hand edit other cases who got "-3" because of stopping date but have same school type for all valid schools
or the most recent school is detectable from the other information such as interview date;
flag1=0;
flag2=0;
if sltype=-3 and stype1=stype2 and stype1>0 then flag1=1;
if flag1=1 then sltype=1;
if int_y=-5 then sltype=-5;

endsas;


Return to top


Date Received Diploma or Degree

Variables Created: 

 Variables Used

Name in Program Question Name in Data   Name in Program Question Name in Data   Name in Program Question Name in Data

Round 1:

 

 

Round 4 con't:

 

 

Round 7 con't:

 

gdr1

CV_GED

 

stopyr4_22

NEWSCHOOL_STOP2.02~Y

 

stopmr7_22

NEWSCHOOL_STOP2.02~M

hsr1

CV_HS_DIPLOMA

 

stopmr4_23

NEWSCHOOL_STOP2.03~M

 

stopyr7_22

NEWSCHOOL_STOP2.02~Y

Doicmr1

CV_INTERVIEW_CMONTH

 

stopyr4_23

NEWSCHOOL_STOP2.03~Y

 

stopmr7_31

NEWSCHOOL_STOP3.01~M

intdr1

CV_INTERVIEW_DATE~D

 

scoder4_1-_5

NEWSCHOOL_SCHCODE.01-.05

 

stopyr7_31

NEWSCHOOL_STOP3.01~Y

intmr1

CV_INTERVIEW_DATE~M

 

lftsc2r4_1, _2

NEWSCHOOL_LEFT2.01, .02

 

e21300r7_101-_109

YSCH-213001.01-.09

intyr1

CV_INTERVIEW_DATE~Y

 

e21300r4_101-_108

YSCH-21300.01.01-.08

 

e21300r7_201-_209

YSCH-21300.02.01-.09

e21300r1_101-_102

YSCH-21300.01.01-.02

 

e21300r4_201-_206

YSCH-21300.02.01-.06

 

e21300r7_301-_303

YSCH-21300.03.01-.03

e21400r1_101-_102

YSCH-21400.01.01-.02

 

e21300r4_301, _302

YSCH-21300.03.01, .02

 

e21300r7_401

YSCH-21300.04.01

 

 

 

e21300r4_401, _402

YSCH-21300.04.01, .02

 

e21300r7_501

YSCH-21300.05.01

Round 2:

 

 

e21400r4_101-_108

YSCH-21400.01.01-.08

 

e21400r7_101-_109

YSCH-21400.01.01-.09

gdr2

CV_GED

 

e21400r4_201-_206

YSCH-21400.02.01-.06

 

e21400r7_201-_209

YSCH-21400.02.01-.09

hsr2

CV_HS_DIPLOMA

 

e21400r4_301, _302

YSCH-21400.03.01, .02

 

e21400r7_301-_303

YSCH-21400.03.01-.03

doicmr2

CV_INTERVIEW_CMONTH

 

e21400r4_401, _402

YSCH-21400.04.01, .02

 

e21400r7_401

YSCH-21400.04.01

intdr2

CV_INTERVIEW_DATE~D

 

schidr4_1-_5

NEWSCHOOL_PUBID.01-.05

 

schidr7_1-_5

NEWSCHOOL_PUBID.01-.05

intmr2

CV_INTERVIEW_DATE~M

 

 

 

 

 

 

intyr2

CV_INTERVIEW_DATE~Y

 

Round 5:

 

 

Round 8:

 

e27337r2_1-_5

YSCH-27337.01-.05

 

gdr5

CV_GED

 

gdr8

CV_GED

e23450r2_1-_4

YSCH-23450.01-.04

 

hsr5

CV_HS_DIPLOMA

 

hsr8

CV_HS_DIPLOMA

stopmr2_11

NEWSCHOOL_STOP1.01~M

 

aar5

CV_AA_DEGREE

 

aar8

CV_AA_DEGREE

stopyr2_11

NEWSCHOOL_STOP1.01~Y

 

bar5

CV_BA_DEGREE

 

bar8

CV_BA_DEGREE

stopmr2_12

NEWSCHOOL_STOP1.02~M

 

doicmr5

CV_INTERVIEW_CMONTH

 

mar8

CV_MA_DEGREE

stopyr2_12

NEWSCHOOL_STOP1.02~Y

 

intdr5

CV_INTERVIEW_DATE~D

 

doicmr8

CV_INTERVIEW_CMONTH

stopmr2_13

NEWSCHOOL_STOP1.03~M

 

intmr5

CV_INTERVIEW_DATE~M

 

intmr8

CV_INTERVIEW_DATE~M

stopyr2_13

NEWSCHOOL_STOP1.03~Y

 

intyr5

CV_INTERVIEW_DATE~Y

 

intyr8

CV_INTERVIEW_DATE~Y

stopmr2_14

NEWSCHOOL_STOP1.04~M

 

e27337r5_1-_6

YSCH-27337.01-.06

 

e3113r8

YSCH-3113

stopyr2_14

NEWSCHOOL_STOP1.04~Y

 

e23450r5_1-_6

YSCH-23450.01-.06

 

e27337r8_1-_5

YSCH-27337.01-.05

stopmr2_15

NEWSCHOOL_STOP1.05~M

 

lftscr5_1-_6

NEWSCHOOL_LEFT.01-.06

 

e21300r8_101-_113

YSCH-21300.01.01-.13

stopyr2_15

NEWSCHOOL_STOP1.05~Y

 

stopmr5_11

NEWSCHOOL_STOP1.01~M

 

e21300r8_201-_208

YSCH-21300.02.01-.08

stopmr2_16

NEWSCHOOL_STOP1.06~M

 

stopyr5_11

NEWSCHOOL_STOP1.01~Y

 

e21300r8_301-_305

YSCH-21300.03.01-.05

stopyr2_16

NEWSCHOOL_STOP1.06~Y

 

stopmr5_12

NEWSCHOOL_STOP1.02~M

 

e21300r8_401

YSCH-21300.04.01

stopmr2_21

NEWSCHOOL_STOP2.01~M

 

stopyr5_12

NEWSCHOOL_STOP1.02~Y

 

e21400r8_101-_113

YSCH-21400.01.01-.13

stopyr2_21

NEWSCHOOL_STOP2.01~Y

 

stopmr5_13

NEWSCHOOL_STOP1.03~M

 

e21400r8_201-_208

YSCH-21400.02.01-.08

stopmr2_22

NEWSCHOOL_STOP2.02~M

 

stopyr5_13

NEWSCHOOL_STOP1.03~Y

 

e21400r8_301-_305

YSCH-21400.03.01-.05

stopyr2_22

NEWSCHOOL_STOP2.02~Y

 

stopmr5_14

NEWSCHOOL_STOP1.04~M

 

e23450r8_1-_3

YSCH-23450.01-.03

stopmr2_23

NEWSCHOOL_STOP2.03~M

 

stopyr5_14

NEWSCHOOL_STOP1.04~Y

 

lftscr8_1-_5

NEWSCHOOL_LEFT.01-.05

stopyr2_23

NEWSCHOOL_STOP2.03~Y

 

stopmr5_15

NEWSCHOOL_STOP1.05~M

 

scoder8_1-_5

NEWSCHOOL_SCHCODE.01-.05

stopmr2_24

NEWSCHOOL_STOP2.04~M

 

stopyr5_15

NEWSCHOOL_STOP1.05~Y

 

stopmr8_11

NEWSCHOOL_STOP1.01~M

stopyr2_24

NEWSCHOOL_STOP2.04~Y

 

stopmr5_16

NEWSCHOOL_STOP1.06~M

 

stopyr8_11

NEWSCHOOL_STOP1.01~Y

stopmr2_31

NEWSCHOOL_STOP3.01~M

 

stopyr5_16

NEWSCHOOL_STOP1.06~Y

 

stopmr8_12

NEWSCHOOL_STOP1.02~M

stopyr2_31

NEWSCHOOL_STOP3.01~Y

 

stopmr5_21

NEWSCHOOL_STOP2.01~M

 

stopyr8_12

NEWSCHOOL_STOP1.02~Y

scoder2_1-_6

NEWSCHOOL_SCHCODE.01-.06

 

stopyr5_21

NEWSCHOOL_STOP2.01~Y

 

stopmr8_13

NEWSCHOOL_STOP1.03~M

lftscr2_1-_6

NEWSCHOOL_LEFT.01-.06

 

stopmr5_22

NEWSCHOOL_STOP2.02~M

 

stopyr8_13

NEWSCHOOL_STOP1.03~Y

e21300r2_101-_105

YSCH-21300.01.01-.05

 

stopyr5_22

NEWSCHOOL_STOP2.02~Y

 

stopmr8_14

NEWSCHOOL_STOP1.04~M

e21300r2_201-_205

YSCH-21300.02.01-.05

 

stopmr5_23

NEWSCHOOL_STOP2.03~M

 

stopyr8_14

NEWSCHOOL_STOP1.04~Y

e21300r2_301-_305

YSCH-21300.03.01-.05

 

stopyr5_23

NEWSCHOOL_STOP2.03~Y

 

stopmr8_15

NEWSCHOOL_STOP1.05~M

e21300r2_401

YSCH-21300.04.01

 

stopmr5_31

NEWSCHOOL_STOP3.01~M

 

stopyr8_15

NEWSCHOOL_STOP1.05~Y

e21300r2_501

YSCH-21300.05.01

 

stopyr5_31

NEWSCHOOL_STOP3.01~Y

 

stopmr8_21

NEWSCHOOL_STOP2.01~M

e21400r2_101-_105

YSCH-21400.01.01-.05

 

scoder5_1-_6

NEWSCHOOL_SCHCODE.01-.06

 

stopyr8_21

NEWSCHOOL_STOP2.01~Y

e21400r2_201-_205

YSCH-21400.02.01-.05

 

lftsc2r5_2, _3

NEWSCHOOL_LEFT2.02, .03

 

stopmr8_22

NEWSCHOOL_STOP2.02~M

e21400r2_301-_305

YSCH-21400.03.01-.05

 

lftsc2r5_2-_4

NEWSCHOOL_LEFT2.02-.04

 

stopyr8_22

NEWSCHOOL_STOP2.02~Y

e21400r2_401

YSCH-21400.04.01

 

e21300r5_101-_107

YSCH-21300.01.01-.07

 

stopmr8_31

NEWSCHOOL_STOP3.01~M

e21400r2_501

YSCH-21400.05.01

 

e21300r5_201-_207

YSCH-21300.02.01-.07

 

stopyr8_31

NEWSCHOOL_STOP3.01~Y

schidr2_1-_6

NEWSCHOOL_PUBID.01-.06

 

e21300r5_301-_304

YSCH-21300.03.01-.04

 

stopmr8_32

NEWSCHOOL_STOP3.02~M

 

 

 

e21300r5_401

YSCH-21300.04.01

 

stopyr8_32

NEWSCHOOL_STOP3.02~Y

Round 3:

 

 

e21300r5_501, _502

YSCH-21300.05.01, .02

 

schidr8_1

NEWSCHOOL_PUBID.01

gdr3

CV_GED

 

e21300r5_601

YSCH-21300.06.01

 

schidr8_2

NEWSCHOOL_PUBID.02

hsr3

CV_HS_DIPLOMA

 

e21400r5_101-_107

YSCH-21400.01.01-.07

 

schidr8_3

NEWSCHOOL_PUBID.03

aar3

CV_AA_DEGREE

 

e21400r5_201-_207

YSCH-21400.02.01-.07

 

schidr8_4

NEWSCHOOL_PUBID.04

bar3

CV_BA_DEGREE

 

e21400r5_301-_303

YSCH-21400.03.01-.03

 

schidr8_5

NEWSCHOOL_PUBID.05

doicmr3

CV_INTERVIEW_CMONTH

 

e21400r5_401

YSCH-21400.04.01

 

 

 

intdr3

CV_INTERVIEW_DATE~D

 

e21400r5_501, _502

YSCH-21400.05.01, .02

 

Round 9:

 

intmr3

CV_INTERVIEW_DATE~M

 

e21400r5_601

YSCH-21400.06.01

 

PUBID

PUBID

intyr3

CV_INTERVIEW_DATE~Y

 

schidr5_1-_6

NEWSCHOOL_PUBID.01-.06

 

e3113r9

YSCH-3113

e27337r3_1-_5

YSCH-27337.01-.05

 

 

 

 

e11700r9

YSCH-11700

e23450r3_1-_3

YSCH-23450.01-.03

 

Round 6:

 

 

e11900mr9

YSCH-11900~M

stopmr3_11

NEWSCHOOL_STOP1.01~M

 

gdr6

CV_GED

 

e11900yr9

YSCH-11900~Y

stopyr3_11

NEWSCHOOL_STOP1.01~Y

 

hsr6

CV_HS_DIPLOMA

 

e13300r9

YSCH-13300

stopmr3_12

NEWSCHOOL_STOP1.02~M

 

aar6

CV_AA_DEGREE

 

e13500mr9

YSCH-13500~M

stopyr3_12

NEWSCHOOL_STOP1.02~Y

 

bar6

CV_BA_DEGREE

 

e13500yr9

YSCH-13500~Y

stopmr3_13

NEWSCHOOL_STOP1.03~M

 

mar6

CV_MA_DEGREE

 

e24685r9

YSCH-24685

stopyr3_13

NEWSCHOOL_STOP1.03~Y

 

doicmr6

CV_INTERVIEW_CMONTH

 

e27337r9_1-_4

YSCH-27337.01-.04

stopmr3_14

NEWSCHOOL_STOP1.04~M

 

intdr6

CV_INTERVIEW_DATE~D

 

e21300r9_101-_112

YSCH-21300.01.01-.12

stopyr3_14

NEWSCHOOL_STOP1.04~Y

 

intmr6

CV_INTERVIEW_DATE~M

 

e21300r9_201-_218

YSCH-21300.02.01-.18

stopmr3_15

NEWSCHOOL_STOP1.05~M

 

intyr6

CV_INTERVIEW_DATE~Y

 

e21300r9_301-_309

YSCH-21300.03.01-.09

stopyr3_15

NEWSCHOOL_STOP1.05~Y

 

e27337r6_1-_5

YSCH-27337.01-.05

 

e21300r9_401-_406

YSCH-21300.04.01-.06

stopmr3_16

NEWSCHOOL_STOP1.06~M

 

e23450r6_1-_5

YSCH-23450.01-.05

 

e21400r9_101-_112

YSCH-21400.01.01-.12

stopyr3_16

NEWSCHOOL_STOP1.06~Y

 

lftscr6_1-_4

NEWSCHOOL_LEFT.01-.04

 

e21400r9_201-_217

YSCH-21400.02.01-.17

stopmr3_17

NEWSCHOOL_STOP1.07~M

 

scoder6_1-_4

NEWSCHOOL_SCHCODE.01-.04

 

e21400r9_301-_309

YSCH-21400.03.01-.09

stopyr3_17

NEWSCHOOL_STOP1.07~Y

 

stopmr6_11

NEWSCHOOL_STOP1.01~M

 

e21400r9_401-_406

YSCH-21400.04.01-.06

stopmr3_21

NEWSCHOOL_STOP2.01~M

 

stopyr6_11

NEWSCHOOL_STOP1.01~Y

 

e23450r9_1-_3

YSCH-23450.01-.03

stopyr3_21

NEWSCHOOL_STOP2.01~Y

 

stopmr6_12

NEWSCHOOL_STOP1.02~M

 

e23460mr9_1

YSCH-23460.01~M

stopmr3_22

NEWSCHOOL_STOP2.02~M

 

stopyr6_12

NEWSCHOOL_STOP1.02~Y

 

e23460yr9_1

YSCH-23460.01~Y

stopyr3_22

NEWSCHOOL_STOP2.02~Y

 

stopmr6_13

NEWSCHOOL_STOP1.03~M

 

e23460mr9_2

YSCH-23460.02~M

stopmr3_23

NEWSCHOOL_STOP2.03~M

 

stopyr6_13

NEWSCHOOL_STOP1.03~Y

 

e23460yr9_2

YSCH-23460.02~Y

stopyr3_23

NEWSCHOOL_STOP2.03~Y

 

stopmr6_14

NEWSCHOOL_STOP1.04~M

 

e23460mr9_3

YSCH-23460.03~M

stopmr3_24

NEWSCHOOL_STOP2.04~M

 

stopyr6_14

NEWSCHOOL_STOP1.04~Y

 

e23460yr9_3

YSCH-23460.03~Y

stopyr3_24

NEWSCHOOL_STOP2.04~Y

 

stopmr6_21

NEWSCHOOL_STOP2.01~M

 

e7000r9_1-_3

YSCH-7000.01-.03

stopmr3_31

NEWSCHOOL_STOP3.01~M

 

stopyr6_21

NEWSCHOOL_STOP2.01~Y

 

e7050r9_1-_3

YSCH-7050.01-.03

stopyr3_31

NEWSCHOOL_STOP3.01~Y

 

stopmr6_22

NEWSCHOOL_STOP2.02~M

 

e7100mr9_1

YSCH-7100.01~M

stopmr3_32

NEWSCHOOL_STOP3.02~M

 

stopyr6_22

NEWSCHOOL_STOP2.02~Y

 

e7100yr9_1

YSCH-7100.01~Y

stopyr3_32

NEWSCHOOL_STOP3.02~Y

 

stopmr6_23

NEWSCHOOL_STOP2.03~M

 

e7100mr9_2

YSCH-7100.02~M

scoder3_1-_7

NEWSCHOOL_SCHCODE.01-.07

 

stopyr6_23

NEWSCHOOL_STOP2.03~Y

 

e7100yr9_2

YSCH-7100.02~Y

lftscr3_1-_7

NEWSCHOOL_LEFT.01-.07

 

e21300r6_101-_111

YSCH-21300.01.01-.11

 

e7100mr9_3

YSCH-7100.03~M

lftsc2r3_1, _2

NEWSCHOOL_LEFT2.01, .02

 

e21300r6_201-_212

YSCH-21300.02.01-.12

 

e7100yr9_3

YSCH-7100.03~Y

e21300r3_101-_105

YSCH-21300.01.01-.05

 

e21300r6_301-_304

YSCH-21300.03.01-.04

 

t7000r9_1-_9

YTRN-7000.01-.09

e21300r3_201-_205

YSCH-21300.02.01-.05

 

e21300r6_401-_403

YSCH-21300.04.01-.03

 

intdr9

SYMBOL_CURDATE~D

e21300r3_301-_303

YSCH-21300.03.01-.03

 

e21300r6_501

YSCH-21300.05.01

 

intmr9

SYMBOL_CURDATE~M

e21300r3_401

YSCH-21300.04.01

 

e21400r6_101-_111

YSCH-21400.01.01-.11

 

intyr9

SYMBOL_CURDATE~Y

e21400r3_101-_105

YSCH-21400.01.01-.05

 

e21400r6_201-_212

YSCH-21400.02.01-.12

 

lftscr9_1-_4

NEWSCHOOL_LEFT.01-.04

e21400r3_201-_205

YSCH-21400.02.01-.05

 

e21400r6_301-_303

YSCH-21400.03.01-.03

 

scoder9_1-_4

NEWSCHOOL_SCHCODE.01-.04

e21400r3_301-_303

YSCH-21400.03.01-.03

 

e21400r6_401-_403

YSCH-21400.04.01-.03

 

strtmr9_11

NEWSCHOOL_START1.01~M

e21400r3_401

YSCH-21400.04.01

 

schidr6_1-_4

NEWSCHOOL_PUBID.01-.04

 

strtyr9_11

NEWSCHOOL_START1.01~Y

schidr3_1-_7

NEWSCHOOL_PUBID.01-.07

 

 

 

 

strtmr9_12

NEWSCHOOL_START1.02~M

 

 

 

Round 7:

 

 

strtyr9_12

NEWSCHOOL_START1.02~Y

Round 4:

 

 

gdr7

CV_GED

 

strtmr9_13

NEWSCHOOL_START1.03~M

gdr4

CV_GED

 

hsr7

CV_HS_DIPLOMA

 

strtyr9_13

NEWSCHOOL_START1.03~Y

hsr4

CV_HS_DIPLOMA

 

aar7

CV_AA_DEGREE

 

strtmr9_14

NEWSCHOOL_START1.04~M

aar4

CV_AA_DEGREE

 

bar7

CV_BA_DEGREE

 

strtyr9_14

NEWSCHOOL_START1.04~Y

bar4

CV_BA_DEGREE

 

mar7

CV_MA_DEGREE

 

stopmr9_11

NEWSCHOOL_STOP1.01~M

doicmr4

CV_INTERVIEW_CMONTH

 

doicmr7

CV_INTERVIEW_CMONTH

 

stopyr9_11

NEWSCHOOL_STOP1.01~Y

intdr4

CV_INTERVIEW_DATE~D

 

intdr7

CV_INTERVIEW_DATE~D

 

stopmr9_12

NEWSCHOOL_STOP1.02~M

intmr4

CV_INTERVIEW_DATE~M

 

intmr7

CV_INTERVIEW_DATE~M

 

stopyr9_12

NEWSCHOOL_STOP1.02~Y

intyr4

CV_INTERVIEW_DATE~Y

 

intyr7

CV_INTERVIEW_DATE~Y

 

stopmr9_13

NEWSCHOOL_STOP1.03~M

e27337r4_1-_4

YSCH-27337.01-.04

 

e27337r7_1-_5

YSCH-27337.01-.05

 

stopyr9_13

NEWSCHOOL_STOP1.03~Y

e23450r4_1-_3

YSCH-23450.01-.03

 

e23450r7_1-_3

YSCH-23450.01-.03

 

stopmr9_14

NEWSCHOOL_STOP1.04~M

lftscr4_1-_5

NEWSCHOOL_LEFT.01-.05

 

lftscr7_1-_5

NEWSCHOOL_LEFT.01-.05

 

stopyr9_14

NEWSCHOOL_STOP1.04~Y

stopmr4_11

NEWSCHOOL_STOP1.01~M

 

scoder7_1-_5

NEWSCHOOL_SCHCODE.01-.05

 

strtmr9_21

NEWSCHOOL_START2.01~M

stopyr4_11

NEWSCHOOL_STOP1.01~Y

 

stopmr7_11

NEWSCHOOL_STOP1.01~M

 

strtyr9_21

NEWSCHOOL_START2.01~Y

stopmr4_12

NEWSCHOOL_STOP1.02~M

 

stopyr7_11

NEWSCHOOL_STOP1.01~Y

 

strtmr9_23

NEWSCHOOL_START2.03~M

stopyr4_12

NEWSCHOOL_STOP1.02~Y

 

stopmr7_12

NEWSCHOOL_STOP1.02~M

 

strtyr9_23

NEWSCHOOL_START2.03~Y

stopmr4_13

NEWSCHOOL_STOP1.03~M

 

stopyr7_12

NEWSCHOOL_STOP1.02~Y

 

stopmr9_21

NEWSCHOOL_STOP2.01~M

stopyr4_13

NEWSCHOOL_STOP1.03~Y

 

stopmr7_13

NEWSCHOOL_STOP1.03~M

 

stopyr9_21

NEWSCHOOL_STOP2.01~Y

stopmr4_14

NEWSCHOOL_STOP1.04~M

 

stopyr7_13

NEWSCHOOL_STOP1.03~Y

 

stopmr9_23

NEWSCHOOL_STOP2.03~M

stopyr4_14

NEWSCHOOL_STOP1.04~Y

 

stopmr7_14

NEWSCHOOL_STOP1.04~M

 

stopyr9_23

NEWSCHOOL_STOP2.03~Y

stopmr4_15

NEWSCHOOL_STOP1.05~M

 

stopyr7_14

NEWSCHOOL_STOP1.04~Y

 

strtmr9_31

NEWSCHOOL_START3.01~M

stopyr4_15

NEWSCHOOL_STOP1.05~Y

 

stopmr7_15

NEWSCHOOL_STOP1.05~M

 

strtyr9_31

NEWSCHOOL_START3.01~Y

stopmr4_21

NEWSCHOOL_STOP2.01~M

 

stopyr7_15

NEWSCHOOL_STOP1.05~Y

 

stopmr9_31

NEWSCHOOL_STOP3.01~M

stopyr4_21

NEWSCHOOL_STOP2.01~Y

 

stopmr7_21

NEWSCHOOL_STOP2.01~M

 

stopyr9_31

NEWSCHOOL_STOP3.01~Y

stopmr4_22

NEWSCHOOL_STOP2.02~M

 

stopyr7_21

NEWSCHOOL_STOP2.01~Y

 

schidr9_1-_4

NEWSCHOOL_PUBID.01-.04

This program creates the variables that indicate the dates on which the youth received GED, High School Diploma, Associate Degree, Bachelor's Degree, Master's Degree, Doctoral Degree and Professional Degree from NLSY97 round 9 (2005). The dates will be calculated as the number of accumulated months from 1980. Also, the program will check if there is some conflict in these answers between round 9 and earlier rounds.


/*******************************************************************************************************
** NOTE: If there are two or more valid but different dates for a degree receipt then we take the **
** date reported in the earlier round as that would have been closer to the actual date except GED **
** receipt dates. In those cases we consider whether the earlier date that R reported was the date**
** that R took the exam and the later date is the date R actually received the GED. **
** **
** NOTE: If R attends college without a High School diploma or GED then R is asked for an **
** explanation in question, YSCH-13900. If R reports receiving a HS diploma or GED but gives no date **
** of receipt then we give corresponding date of degree received as -3. **
** **
** NOTE: Also, if R reports receiving GED or H.S. Diploma in YSCH-3113 that has not been reported **
** elsewhere then we give the date of degree received as -3. If R reports a highest degree received **
** in this question as an AA or higher degree and we find evidence that R was indeed in college, had **
** a major of study, was pursuing that degree and left the college because R graduated or finished **
** coursework then we the stop date of that enrollment as the date of receiving that degree. The **
** same rule (except for having decided on a major is used if R reports attending college to receive **
** GED. **
*******************************************************************************************************/

*** Define all arrays to be used in this program:;
array CR1 (7) gdr1 hsr1 aar1 bar1 mar1 dcr1 pfr1;
array CR2 (7) gdr2 hsr2 aar2 bar2 mar2 dcr2 pfr2;
array CR3 (7) gdr3 hsr3 aar3 bar3 mar3 dcr3 pfr3;
array CR4 (7) gdr4 hsr4 aar4 bar4 mar4 dcr4 pfr4;
array CR5 (7) gdr5 hsr5 aar5 bar5 mar5 dcr5 pfr5;
array CR6 (7) gdr6 hsr6 aar6 bar6 mar6 dcr6 pfr6;
array CR7 (7) gdr7 hsr7 aar7 bar7 mar7 dcr7 pfr7;
array CR8 (7) gdr8 hsr8 aar8 bar8 mar8 dcr8 pfr8;
array CRP (7) gdrP hsrP aarP barP marP dcrP pfrP;
array CRC (7) gdrC hsrC aarC barC marC dcrC pfrC;
array CDT (7) CDTGD CDTHS CDTAA CDTBA CDTMA CDTDC CDTPF;
array YDT (7) ydtGD ydtHS ydtAA ydtBA ydtMA ydtDC ydtPF;
array HED (7) hedGD hedHS hedAA hedBA hedMA hedDC hedPF;
array FLG (7) flgGD flgHS flgAA flgBA flgMA flgDC flgPF;
array QUX (7) quxGD quxHS quxAA quxBA quxMA quxDC quxPF;
array DEG (7) degGD degHS degAA degBA degMA degDC degPF;
array TMPDG (4) TMPDG1-TMPDG4;
array e23460mr9 (4) e23460mr9_1-e23460mr9_4;
array e23460yr9 (4) e23460yr9_1-e23460yr9_4;
array t7000r9 (9) t7000r9_1-t7000r9_9;
array scoder1 (2) scoder1_1-scoder1_2;
array scoder2 (6) scoder2_1-scoder2_6;
array scoder3 (7) scoder3_1-scoder3_7;
array scoder4 (5) scoder4_1-scoder4_5;
array scoder5 (6) scoder5_1-scoder5_6;
array scoder6 (5) scoder6_1-scoder6_5;
array scoder7 (5) scoder7_1-scoder7_5;
array scoder8 (5) scoder8_1-scoder8_5;
array scoder9 (4) scoder9_1-scoder9_4;
array lftscr1 (2) lftscr1_1-lftscr1_2;
array lftscr2 (6) lftscr2_1-lftscr2_6;
array lftscr3 (7) lftscr3_1-lftscr3_7;
array lftscr4 (5) lftscr4_1-lftscr4_5;
array lftscr5 (6) lftscr5_1-lftscr5_6;
array lftscr6 (5) lftscr6_1-lftscr6_5;
array lftscr7 (5) lftscr7_1-lftscr7_5;
array lftscr8 (5) lftscr8_1-lftscr8_5;
array lftscr9 (4) lftscr9_1-lftscr9_4;
array lftsc2r2 (6) lftsc2r2_1-lftsc2r2_6;
array lftsc2r3 (7) lftsc2r3_1-lftsc2r3_7;
array lftsc2r4 (5) lftsc2r4_1-lftsc2r4_5;
array lftsc2r5 (6) lftsc2r5_1-lftsc2r5_6;
array lftsc2r6 (5) lftsc2r6_1-lftsc2r6_5;
array lftsc2r7 (5) lftsc2r7_1-lftsc2r7_5;
array lftsc2r8 (5) lftsc2r8_1-lftsc2r8_5;
array lftsc2r9 (4) lftsc2r9_1-lftsc2r9_4;
array e27337r2 (6) e27337r2_1-e27337r2_6;
array e27337r3 (7) e27337r3_1-e27337r3_7;
array e27337r4 (5) e27337r4_1-e27337r4_5;
array e27337r5 (6) e27337r5_1-e27337r5_6;
array e27337r6 (5) e27337r6_1-e27337r6_5;
array e27337r7 (5) e27337r7_1-e27337r7_5;
array e27337r8 (5) e27337r8_1-e27337r8_5;
array e27337r9 (4) e27337r9_1-e27337r9_4;
array e23450r2 (6) e23450r2_1-e23450r2_6;
array e23450r3 (7) e23450r3_1-e23450r3_7;
array e23450r4 (5) e23450r4_1-e23450r4_5;
array e23450r5 (6) e23450r5_1-e23450r5_6;
array e23450r6 (5) e23450r6_1-e23450r6_5;
array e23450r7 (5) e23450r7_1-e23450r7_5;
array e23450r8 (5) e23450r8_1-e23450r8_5;
array e23450r9 (4) e23450r9_1-e23450r9_4;
array schidr1 (2) schidr1_1-schidr1_2;
array schidr2 (6) schidr2_1-schidr2_6;
array schidr3 (7) schidr3_1-schidr3_7;
array schidr4 (5) schidr4_1-schidr4_5;
array schidr5 (6) schidr5_1-schidr5_6;
array schidr6 (5) schidr6_1-schidr6_5;
array schidr7 (5) schidr7_1-schidr7_5;
array schidr8 (5) schidr8_1-schidr8_5;
array schidr9 (4) schidr9_1-schidr9_4;
array major1 (*) e21300r1_101 e21400r1_101;
array major21 (*) e21300r2_101-e21300r2_105 e21400r2_101-e21400r2_105;
array major22 (*) e21300r2_201-e21300r2_205 e21400r2_201-e21400r2_205;
array major23 (*) e21300r2_301-e21300r2_305 e21400r2_301-e21400r2_305;
array major24 (*) e21300r2_401 e21400r2_401;
array major25 (*) e21300r2_501 e21400r2_501;
array major31 (*) e21300r3_101-e21300r3_105 e21400r3_101-e21400r3_105;
array major32 (*) e21300r3_201-e21300r3_205 e21400r3_201-e21400r3_205;
array major33 (*) e21300r3_301-e21300r3_303 e21400r3_301-e21400r3_303;
array major34 (*) e21300r3_401 e21400r3_401;
array major41 (*) e21300r4_101-e21300r4_108 e21400r4_101-e21400r4_108;
array major42 (*) e21300r4_201-e21300r4_206 e21400r4_201-e21400r4_206;
array major43 (*) e21300r4_301-e21300r4_302 e21400r4_301-e21400r4_302;
array major44 (*) e21300r4_401-e21300r4_402 e21400r4_401-e21400r4_402;
array major51 (*) e21300r5_101-e21300r5_107 e21400r5_101-e21400r5_107;
array major52 (*) e21300r5_201-e21300r5_207 e21400r5_201-e21400r5_207;
array major53 (*) e21300r5_301-e21300r5_304 e21400r5_301-e21400r5_304;
array major54 (*) e21300r5_401 e21400r5_401;
array major55 (*) e21300r5_501-e21300r5_502 e21400r5_501-e21400r5_502;
array major56 (*) e21300r5_601 e21400r5_601;
array major61 (*) e21300r6_101-e21300r6_111 e21400r6_101-e21400r6_111;
array major62 (*) e21300r6_201-e21300r6_212 e21400r6_201-e21400r6_212;
array major63 (*) e21300r6_301-e21300r6_304 e21400r6_301-e21400r6_304;
array major64 (*) e21300r6_401-e21300r6_403 e21400r6_401-e21400r6_403;
array major65 (*) e21300r6_501 e21400r6_501;
array major71 (*) e21300r7_101-e21300r7_109 e21400r7_101-e21400r7_109;
array major72 (*) e21300r7_201-e21300r7_209 e21400r7_201-e21400r7_209;
array major73 (*) e21300r7_301-e21300r7_303 e21400r7_301-e21400r7_303;
array major74 (*) e21300r7_401 e21400r7_401;
array major75 (*) e21300r7_501 e21400r7_501;
array major81 (*) e21300r8_101-e21300r8_113 e21400r8_101-e21400r8_113;
array major82 (*) e21300r8_201-e21300r8_208 e21400r8_201-e21400r8_208;
array major83 (*) e21300r8_301-e21300r8_305 e21400r8_301-e21400r8_305;
array major84 (*) e21300r8_401 e21400r8_401;
array major91 (*) e21300r9_101-e21300r9_112 e21400r9_101-e21400r9_112;
array major92 (*) e21300r9_201-e21300r9_218 e21400r9_201-e21400r9_218;
array major93 (*) e21300r9_301-e21300r9_309 e21400r9_301-e21400r9_309;
array major94 (*) e21300r9_401-e21300r9_406 e21400r9_401-e21400r9_406;
array stopmr2 (6,3) stopmr2_11 stopmr2_21 stopmr2_31 stopmr2_12 stopmr2_22 stopmr2_32
stopmr2_13 stopmr2_23 stopmr2_33 stopmr2_14 stopmr2_24 stopmr2_34
stopmr2_15 stopmr2_25 stopmr2_35 stopmr2_16 stopmr2_26 stopmr2_36;

array stopyr2 (6,3) stopyr2_11 stopyr2_21 stopyr2_31 stopyr2_12 stopyr2_22 stopyr2_32
stopyr2_13 stopyr2_23 stopyr2_33 stopyr2_14 stopyr2_24 stopyr2_34
stopyr2_15 stopyr2_25 stopyr2_35 stopyr2_16 stopyr2_26 stopyr2_36;

array stopmr3 (7,3) stopmr3_11 stopmr3_21 stopmr3_31 stopmr3_12 stopmr3_22 stopmr3_32
stopmr3_13 stopmr3_23 stopmr3_33 stopmr3_14 stopmr3_24 stopmr3_34
stopmr3_15 stopmr3_25 stopmr3_35 stopmr3_16 stopmr3_26 stopmr3_36
stopmr3_17 stopmr3_27 stopmr3_37;

array stopyr3 (7,3) stopyr3_11 stopyr3_21 stopyr3_31 stopyr3_12 stopyr3_22 stopyr3_32
stopyr3_13 stopyr3_23 stopyr3_33 stopyr3_14 stopyr3_24 stopyr3_34
stopyr3_15 stopyr3_25 stopyr3_35 stopyr3_16 stopyr3_26 stopyr3_36
stopyr3_17 stopyr3_27 stopyr3_37;

array stopmr4 (5,2) stopmr4_11 stopmr4_21 stopmr4_12 stopmr4_22  stopmr4_13 stopmr4_23
stopmr4_14 stopmr4_24 stopmr4_15 stopmr4_25;

array stopyr4 (5,2) stopyr4_11 stopyr4_21 stopyr4_12 stopyr4_22 stopyr4_13 stopyr4_23
stopyr4_14 stopyr4_24 stopyr4_15 stopyr4_25;

array stopmr5 (6,3) stopmr5_11 stopmr5_21 stopmr5_31 stopmr5_12 stopmr5_22 stopmr5_32
stopmr5_13 stopmr5_23 stopmr5_33 stopmr5_14 stopmr5_24 stopmr5_34
stopmr5_15 stopmr5_25 stopmr5_35 stopmr5_16 stopmr5_26 stopmr5_36;

array stopyr5 (6,3) stopyr5_11 stopyr5_21 stopyr5_31  stopyr5_12 stopyr5_22 stopyr5_32
stopyr5_13 stopyr5_23 stopyr5_33 stopyr5_14 stopyr5_24 stopyr5_34
stopyr5_15 stopyr5_25 stopyr5_35 stopyr5_16 stopyr5_26 stopyr5_36;

array stopmr6 (5,2) stopmr6_11 stopmr6_21  stopmr6_12 stopmr6_22  stopmr6_13 stopmr6_23
stopmr6_14 stopmr6_24 stopmr6_15 stopmr6_25;

array stopyr6 (5,2) stopyr6_11 stopyr6_21  stopyr6_12 stopyr6_22  stopyr6_13 stopyr6_23
stopyr6_14 stopyr6_24 stopyr6_15 stopyr6_25;

array stopmr7 (5,3) stopmr7_11 stopmr7_21 stopmr7_31 stopmr7_12 stopmr7_22 stopmr7_32
stopmr7_13 stopmr7_23 stopmr7_33 stopmr7_14 stopmr7_24 stopmr7_34
stopmr7_15 stopmr7_25 stopmr7_35;

array stopyr7 (5,3) stopyr7_11 stopyr7_21 stopyr7_31 stopyr7_12 stopyr7_22 stopyr7_32
stopyr7_13 stopyr7_23 stopyr7_33 stopyr7_14 stopyr7_24 stopyr7_34
stopyr7_15 stopyr7_25 stopyr7_35;

array stopmr8 (5,3) stopmr8_11 stopmr8_21 stopmr8_31 stopmr8_12 stopmr8_22 stopmr8_32
stopmr8_13 stopmr8_23 stopmr8_33 stopmr8_14 stopmr8_24 stopmr8_34
stopmr8_15 stopmr8_25 stopmr8_35;

array stopyr8 (5,3) stopyr8_11 stopyr8_21 stopyr8_31 stopyr8_12 stopyr8_22 stopyr8_32
stopyr8_13 stopyr8_23 stopyr8_33 stopyr8_14 stopyr8_24 stopyr8_34
stopyr8_15 stopyr8_25 stopyr8_35;

array stopmr9 (4,3) stopmr9_11 stopmr9_21 stopmr9_31  stopmr9_12 stopmr9_22 stopmr9_32
stopmr9_13 stopmr9_23 stopmr9_33 stopmr9_14 stopmr9_24 stopmr9_34;

array stopyr9 (4,3) stopyr9_11 stopyr9_21 stopyr9_31  stopyr9_12 stopyr9_22 stopyr9_32
stopyr9_13 stopyr9_23 stopyr9_33 stopyr9_14 stopyr9_24 stopyr9_34;

array stopcr2 (6) stopcr2_1-stopcr2_6;
array stopcr3 (7) stopcr3_1-stopcr3_7;
array stopcr4 (5) stopcr4_1-stopcr4_5;
array stopcr5 (6) stopcr5_1-stopcr5_6;
array stopcr6 (5) stopcr6_1-stopcr6_5;
array stopcr7 (5) stopcr7_1-stopcr7_5;
array stopcr8 (5) stopcr8_1-stopcr8_5;
array stopcr9 (4) stopcr9_1-stopcr9_4;
array anymjr1 (2) anymjr1_1-anymjr1_2;
array anymjr2 (6) anymjr2_1-anymjr2_6;
array anymjr3 (7) anymjr3_1-anymjr3_7;
array anymjr4 (5) anymjr4_1-anymjr4_5;
array anymjr5 (6) anymjr5_1-anymjr5_6;
array anymjr6 (5) anymjr6_1-anymjr6_5;
array anymjr7 (5) anymjr7_1-anymjr7_5;
array anymjr8 (5) anymjr8_1-anymjr8_5;
array anymjr9 (4) anymjr9_1-anymjr9_4;
array clgdgr2 (6) clgdgr2_1-clgdgr2_6;
array clgdgr3 (7) clgdgr3_1-clgdgr3_7;
array clgdgr4 (5) clgdgr4_1-clgdgr4_5;
array clgdgr5 (6) clgdgr5_1-clgdgr5_6;
array clgdgr6 (5) clgdgr6_1-clgdgr6_5;
array clgdgr7 (5) clgdgr7_1-clgdgr7_5;
array clgdgr8 (5) clgdgr8_1-clgdgr8_5;
array clgdgr9 (4) clgdgr9_1-clgdgr9_4;

FLG_13900r9=0; FLG_COMMr9=0;
HE9_GD=0; HE9_HS=0; HE9_AA=0; HE9_BA=0; HE9_MA=0; HE9_DC=0; HE9_PF=0;

*** Initialize Variables.;
** Create enrollment stop dates in continuous month schemes for all rounds;
do i=1 to dim(stopmr9,1);
do j=1 to dim(stopmr9,2);
if stopmr9(i,j)>0 & stopyr9(i,j)>0 then stopcr9(i)=((stopyr9(i,j)-1980)*12)+stopmr9(i,j);
if -3<=stopmr9(i,j)<=-1|-3<=stopyr9(i,j)<=-1 then stopcr9(i)=-3;
end;
end;

do i=1 to dim(stopmr8,1);
do j=1 to dim(stopmr8,2);
if stopmr8(i,j)>0 & stopyr8(i,j)>0 then stopcr8(i)=((stopyr8(i,j)-1980)*12)+stopmr8(i,j);
if -3<=stopmr8(i,j)<=-1|-3<=stopyr8(i,j)<=-1 then stopcr8(i)=-3;
end;
end;

do i=1 to dim(stopmr7,1);
do j=1 to dim(stopmr7,2);
if stopmr7(i,j)>0 & stopyr7(i,j)>0 then stopcr7(i)=((stopyr7(i,j)-1980)*12)+stopmr7(i,j);
if -3<=stopmr7(i,j)<=-1|-3<=stopyr7(i,j)<=-1 then stopcr7(i)=-3;
end;
end;

do i=1 to dim(stopmr6,1);
do j=1 to dim(stopmr6,2);
if stopmr6(i,j)>0 & stopyr6(i,j)>0 then stopcr6(i)=((stopyr6(i,j)-1980)*12)+stopmr6(i,j);
if -3<=stopmr6(i,j)<=-1|-3<=stopyr6(i,j)<=-1 then stopcr6(i)=-3;
end;
end;

do i=1 to dim(stopmr5,1);
do j=1 to dim(stopmr5,2);
if stopmr5(i,j)>0 & stopyr5(i,j)>0 then stopcr5(i)=((stopyr5(i,j)-1980)*12)+stopmr5(i,j);
if -3<=stopmr5(i,j)<=-1|-3<=stopyr5(i,j)<=-1 then stopcr5(i)=-3;
end;
end;

do i=1 to dim(stopmr4,1);
do j=1 to dim(stopmr4,2);
if stopmr4(i,j)>0 & stopyr4(i,j)>0 then stopcr4(i)=((stopyr4(i,j)-1980)*12)+stopmr4(i,j);
if -3<=stopmr4(i,j)<=-1|-3<=stopyr4(i,j)<=-1 then stopcr4(i)=-3;
end;
end;

do i=1 to dim(stopmr3,1);
do j=1 to dim(stopmr3,2);
if stopmr3(i,j)>0 & stopyr3(i,j)>0 then stopcr3(i)=((stopyr3(i,j)-1980)*12)+stopmr3(i,j);
if -3<=stopmr3(i,j)<=-1|-3<=stopyr3(i,j)<=-1 then stopcr3(i)=-3;
end;
end;

do i=1 to dim(stopmr2,1);
do j=1 to dim(stopmr2,2);
if stopmr2(i,j)>0 & stopyr2(i,j)>0 then stopcr2(i)=((stopyr2(i,j)-1980)*12)+stopmr2(i,j);
if -3<=stopmr2(i,j)<=-1|-3<=stopyr2(i,j)<=-1 then stopcr2(i)=-3;
end;
end;

** Set initial values of date of degree received variables to -4. Set all dummies to 0.;
deg_unknown=0;
ged_trn=0;
do i=1 to 7;
CRC(i)=-4; CDT(i)=-4;
DEG(i)=0; FLG(i)=0; QUX(i)=0; HED(i)=0;
end;

*** Identify the latest date of degree received variables from previous rounds.;
do i=1 to 7;
if CR8(i)~=-5 then CRP(i)=CR8(i);
if CR8(i)=-5 then do;
if CR7(i)~=-5 then CRP(i)=CR7(i);
if CR7(i)=-5 then do;
if CR6(i)~=-5 then CRP(i)=CR6(i);
if CR6(i)=-5 then do;
if CR5(i)~=-5 then CRP(i)=CR5(i);
if CR5(i)=-5 then do;
if CR4(i)~=-5 then CRP(i)=CR4(i);
if CR4(i)=-5 then do;
if CR3(i)~=-5 then CRP(i)=CR3(i);
if CR3(i)=-5 then do;
if CR2(i)~=-5 then CRP(i)=CR2(i);
if CR2(i)=-5 then do;
CRP(i)=CR1(i);
end;
end;
end;
end;
end;
end;
end;
end;

*** Create the date of degree received variables using information from current round only;
** Compute the date of receiving GED.;
if e13300r9=-3 then gdrC=-3;
if e13300r9=1 and gdrC<0 then do;
gdrC=-3;
if e13500mr9>0 and e13500yr9>0 then gdrC=(e13500yr9-1980)*12+e13500mr9;
if e13500mr9 in (-4,0) or e13500yr9 in (-4,0) then quxGD=1;
end;

** Compute the date of receiving HS Diploma.;
if e11700r9=-3 then hsrC=-3;
if e11700r9=1 and hsrC<0 then do;
hsrC=-3;
if e11900mr9>0 and e11900yr9>0 then hsrC=(e11900yr9-1980)*12+e11900mr9;
if e11900mr9 in (-4,0) or e11900yr9 in (-4,0) then quxHS=1;
end;

** Compute the dates of receiving GED, AA, BA/BS, MA/MS/MBA/MSW, Ph.D. and MS/LLD/DDS/JD.;
do j=1 to dim(TMPDG);
if e23450r9(j)=1 then TMPDG(j)=3; /* Associate/Junior College or two-year associate degree (AA) */
if e23450r9(j)=3 then TMPDG(j)=4; /* Bachelor's degree (BA, BS or unspecified) */
if e23450r9(j)=4 then TMPDG(j)=5; /* Master's degree (MA, MBA, MS, MSW) */
if e23450r9(j)=5 then TMPDG(j)=6; /* Doctoral Degree (Ph.D.) */
if e23450r9(j)=6 then TMPDG(j)=7; /* Professional Degree (MD, LLD, DDS, JD) */
if e23450r9(j)=9 then TMPDG(j)=2; /* GED */
end;
do j=1 to dim(TMPDG);
do i=2 to 7;
if TMPDG(j)=i and CRC(i)<0 then do;
CRC(i)=-3;
if e23460mr9(j)>0 & e23460yr9(j)>0 then CRC(i)=(e23460yr9(j)-1980)*12+e23460mr9(j);
if e23460mr9(j) in (-4,0) | e23460yr9(j) in (-4,0) then QUX(i)=1;
end;
end;
if e23450r9(j) in (8,999,-1,-2,-3) then deg_unknown=1;
end;

** If GED is completed in a training program, set the date to -3 since don't know completion date.;
do k=1 to dim(t7000r9);
if GDRC=-4 and t7000r9(k)=4 then do;
GDRC=-3;
ged_trn=1;
end;
end;

do i=1 to dim(scoder9);
if e23450r9(i)<=0 & lftscr9(i)=1 & scoder9(i) in (4,5) & e27337r9(i) in (1,3,4,5,6,10) then do;
if e3113r9=4 & cdtaa=-4 then chkdg1=1;
if e3113r9=5 & cdtba=-4 then chkdg1=2;
if e3113r9=6 & cdtma=-4 then chkdg1=3;
if e3113r9=7 & cdtdc=-4 then chkdg1=4;
if e3113r9=8 & cdtpf=-4 then chkdg1=5;
end;
end;

** Compute dummy for whether had decided on a major at the college. Sometimes when R reports being
enrolled in a college and that is a continuing college from DLI information for the major and other
college specific information is not collected (either because of quex problems or because R did not
complete the current term). In such cases we match the that college to a college reported in DLI
and use the major reported for that college.;
** Round 1;
do i=1 to dim(major1);
if major1(i) in (0,98) & anymjr1_1~=1 then anymjr1_1=0;
if major1(i)>0 & anymjr1_1~=98 then anymjr1_1=1;
end;

** Round 2;
do i=1 to dim(major21); if major21(i) in (0,98) & anymjr2_1~=1 then anymjr2_1=0; if major21(i)>0 & anymjr2_1~=98 then anymjr2_1=1; end;
do i=1 to dim(major22); if major22(i) in (0,98) & anymjr2_2~=1 then anymjr2_2=0; if major22(i)>0 & anymjr2_2~=98 then anymjr2_2=1; end;
do i=1 to dim(major23); if major23(i) in (0,98) & anymjr2_3~=1 then anymjr2_3=0; if major23(i)>0 & anymjr2_3~=98 then anymjr2_3=1; end;
do i=1 to dim(major24); if major24(i) in (0,98) & anymjr2_4~=1 then anymjr2_4=0; if major24(i)>0 & anymjr2_4~=98 then anymjr2_4=1; end;
do i=1 to dim(major25); if major25(i) in (0,98) & anymjr2_5~=1 then anymjr2_5=0; if major25(i)>0 & anymjr2_5~=98 then anymjr2_5=1; end;
if anymjr2_1=. then do;
do k=1 to dim(schidr1);
if schidr2_1=schidr1(k) & schidr1(k)>0 & anymjr1(k)>=0 then do;
anymjr2_1=anymjr1(k);
major_FLG_r2=1;
end;
end;
end;

** Round 3;
do i=1 to dim(major31); if major31(i) in (0,98) & anymjr3_1~=1 then anymjr3_1=0; if major31(i)>0 & anymjr3_1~=98 then anymjr3_1=1; end;
do i=1 to dim(major32); if major32(i) in (0,98) & anymjr3_2~=1 then anymjr3_2=0; if major32(i)>0 & anymjr3_2~=98 then anymjr3_2=1; end;
do i=1 to dim(major33); if major33(i) in (0,98) & anymjr3_3~=1 then anymjr3_3=0; if major33(i)>0 & anymjr3_3~=98 then anymjr3_3=1; end;
do i=1 to dim(major34); if major34(i) in (0,98) & anymjr3_4~=1 then anymjr3_4=0; if major34(i)>0 & anymjr3_4~=98 then anymjr3_4=1; end;
if anymjr3_1=. & e3112r3~=-5 then do;
if e3112r2~=-5 then do;
do k=1 to dim(schidr2);
if schidr3_1=schidr2(k) & schidr2(k)>0 & anymjr2(k)>=0 then do;
anymjr3_1=anymjr2(k);
major_FLG_r3=2;
end;
end;
end;
if e3112r2=-5 then do;
do k=1 to dim(schidr1);
if schidr3_1=schidr1(k) & schidr1(k)>0 & anymjr1(k)>=0 then do;
anymjr3_1=anymjr1(k);
major_FLG_r3=1;
end;
end;
end;
end;

** Round 4;
do i=1 to dim(major41); if major41(i) in (0,98) & anymjr4_1~=1 then anymjr4_1=0; if major41(i)>0 & anymjr4_1~=98 then anymjr4_1=1; end;
do i=1 to dim(major42); if major42(i) in (0,98) & anymjr4_2~=1 then anymjr4_2=0; if major42(i)>0 & anymjr4_2~=98 then anymjr4_2=1; end;
do i=1 to dim(major43); if major43(i) in (0,98) & anymjr4_3~=1 then anymjr4_3=0; if major43(i)>0 & anymjr4_3~=98 then anymjr4_3=1; end;
do i=1 to dim(major44); if major44(i) in (0,98) & anymjr4_4~=1 then anymjr4_4=0; if major44(i)>0 & anymjr4_4~=98 then anymjr4_4=1; end;
if anymjr4_1=. & e3112r4~=-5 then do;
if e3112r3~=-5 then do;
do k=1 to dim(schidr3);
if schidr4_1=schidr3(k) & schidr3(k)>0 & anymjr3(k)>=0 then do;
anymjr4_1=anymjr3(k);
major_FLG_r4=3;
end;
end;
end;
if e3112r3=-5 & e3112r2~=-5 then do;
do k=1 to dim(schidr2);
if schidr4_1=schidr2(k) & schidr2(k)>0 & anymjr2(k)>=0 then do;
anymjr4_1=anymjr2(k);
major_FLG_r4=2;
end;
end;
end;
if e3112r3=-5 & e3112r2=-5 then do;
do k=1 to dim(schidr1);
if schidr4_1=schidr1(k) & schidr1(k)>0 & anymjr1(k)>=0 then do;
anymjr4_1=anymjr1(k);
major_FLG_r4=1;
end;
end;
end;
end;

** Round 5;
do i=1 to dim(major51); if major51(i) in (0,98) & anymjr5_1~=1 then anymjr5_1=0; if major51(i)>0 & anymjr5_1~=98 then anymjr5_1=1; end;
do i=1 to dim(major52); if major52(i) in (0,98) & anymjr5_2~=1 then anymjr5_2=0; if major52(i)>0 & anymjr5_2~=98 then anymjr5_2=1; end;
do i=1 to dim(major53); if major53(i) in (0,98) & anymjr5_3~=1 then anymjr5_3=0; if major53(i)>0 & anymjr5_3~=98 then anymjr5_3=1; end;
do i=1 to dim(major54); if major54(i) in (0,98) & anymjr5_4~=1 then anymjr5_4=0; if major54(i)>0 & anymjr5_4~=98 then anymjr5_4=1; end;
do i=1 to dim(major55); if major55(i) in (0,98) & anymjr5_5~=1 then anymjr5_5=0; if major55(i)>0 & anymjr5_5~=98 then anymjr5_5=1; end;
do i=1 to dim(major56); if major56(i) in (0,98) & anymjr5_6~=1 then anymjr5_6=0; if major56(i)>0 & anymjr5_6~=98 then anymjr5_6=1; end;
if anymjr5_1=. & e3112r5~=-5 then do;
if e3112r4~=-5 then do;
do k=1 to dim(schidr4);
if schidr5_1=schidr4(k) & schidr4(k)>0 & anymjr4(k)>=0 then do;
anymjr5_1=anymjr4(k);
major_FLG_r5=4;
end;
end;
end;
if e3112r4=-5 & e3112r3~=-5 then do;
do k=1 to dim(schidr3);
if schidr5_1=schidr3(k) & schidr3(k)>0 & anymjr3(k)>=0 then do;
anymjr5_1=anymjr3(k);
major_FLG_r5=3;
end;
end;
end;
if e3112r4=-5 & e3112r3=-5 & e3112r2~=-5 then do;
do k=1 to dim(schidr2);
if schidr5_1=schidr2(k) & schidr2(k)>0 & anymjr2(k)>=0 then do;
anymjr5_1=anymjr2(k);
major_FLG_r5=2;
end;
end;
end;
if e3112r4=-5 & e3112r3=-5 & e3112r2=-5 then do;
do k=1 to dim(schidr1);
if schidr5_1=schidr1(k) & schidr1(k)>0 & anymjr1(k)>=0 then do;
anymjr5_1=anymjr1(k);
major_FLG_r5=1;
end;
end;
end;
end;

** Round 6;
do i=1 to dim(major61); if major61(i) in (0,98) & anymjr6_1~=1 then anymjr6_1=0; if major61(i)>0 & anymjr6_1~=98 then anymjr6_1=1; end;
do i=1 to dim(major62); if major62(i) in (0,98) & anymjr6_2~=1 then anymjr6_2=0; if major62(i)>0 & anymjr6_2~=98 then anymjr6_2=1; end;
do i=1 to dim(major63); if major63(i) in (0,98) & anymjr6_3~=1 then anymjr6_3=0; if major63(i)>0 & anymjr6_3~=98 then anymjr6_3=1; end;
do i=1 to dim(major64); if major64(i) in (0,98) & anymjr6_4~=1 then anymjr6_4=0; if major64(i)>0 & anymjr6_4~=98 then anymjr6_4=1; end;
do i=1 to dim(major65); if major65(i) in (0,98) & anymjr6_5~=1 then anymjr6_5=0; if major65(i)>0 & anymjr6_5~=98 then anymjr6_5=1; end;
if anymjr6_1=. & e3112r6~=-5 then do;
if e3112r5~=-5 then do;
do k=1 to dim(schidr5);
if schidr6_1=schidr5(k) & schidr5(k)>0 & anymjr5(k)>=0 then do;
anymjr6_1=anymjr5(k);
major_FLG_r6=5;
end;
end;
end;
if e3112r5=-5 & e3112r4~=-5 then do;
do k=1 to dim(schidr4);
if schidr6_1=schidr4(k) & schidr4(k)>0 & anymjr4(k)>=0 then do;
anymjr6_1=anymjr4(k);
major_FLG_r6=4;
end;
end;
end;
if e3112r5=-5 & e3112r4=-5 & e3112r3~=-5 then do;
do k=1 to dim(schidr3);
if schidr6_1=schidr3(k) & schidr3(k)>0 & anymjr3(k)>=0 then do;
anymjr6_1=anymjr3(k);
major_FLG_r6=3;
end;
end;
end;
if e3112r5=-5 & e3112r4=-5 & e3112r3=-5 & e3112r2~=-5 then do;
do k=1 to dim(schidr2);
if schidr6_1=schidr2(k) & schidr2(k)>0 & anymjr2(k)>=0 then do;
anymjr6_1=anymjr2(k);
major_FLG_r6=2;
end;
end;
end;
if e3112r5=-5 & e3112r4=-5 & e3112r3=-5 & e3112r2=-5 then do;
do k=1 to dim(schidr1);
if schidr6_1=schidr1(k) & schidr1(k)>0 & anymjr1(k)>=0 then do;
anymjr6_1=anymjr1(k);
major_FLG_r6=1;
end;
end;
end;
end;

** Round 7;
do i=1 to dim(major71); if major71(i) in (0,98) & anymjr7_1~=1 then anymjr7_1=0; if major71(i)>0 & anymjr7_1~=98 then anymjr7_1=1; end;
do i=1 to dim(major72); if major72(i) in (0,98) & anymjr7_2~=1 then anymjr7_2=0; if major72(i)>0 & anymjr7_2~=98 then anymjr7_2=1; end;
do i=1 to dim(major73); if major73(i) in (0,98) & anymjr7_3~=1 then anymjr7_3=0; if major73(i)>0 & anymjr7_3~=98 then anymjr7_3=1; end;
do i=1 to dim(major74); if major74(i) in (0,98) & anymjr7_4~=1 then anymjr7_4=0; if major74(i)>0 & anymjr7_4~=98 then anymjr7_4=1; end;
do i=1 to dim(major75); if major75(i) in (0,98) & anymjr7_5~=1 then anymjr7_5=0; if major75(i)>0 & anymjr7_5~=98 then anymjr7_5=1; end;
if anymjr7_1=. & e3112r7~=-5 then do;
if e3112r6~=-5 then do;
do k=1 to dim(schidr6);
if schidr7_1=schidr6(k) & schidr6(k)>0 & anymjr6(k)>=0 then do;
anymjr7_1=anymjr6(k);
major_FLG_r7=6;
end;
end;
end;
if e3112r6=-5 & e3112r5~=-5 then do;
do k=1 to dim(schidr5);
if schidr7_1=schidr5(k) & schidr5(k)>0 & anymjr5(k)>=0 then do;
anymjr7_1=anymjr5(k);
major_FLG_r7=5;
end;
end;
end;
if e3112r6=-5 & e3112r5=-5 & e3112r4~=-5 then do;
do k=1 to dim(schidr4);
if schidr7_1=schidr4(k) & schidr4(k)>0 & anymjr4(k)>=0 then do;
anymjr7_1=anymjr4(k);
major_FLG_r7=4;
end;
end;
end;
if e3112r6=-5 & e3112r5=-5 & e3112r4=-5 & e3112r3~=-5 then do;
do k=1 to dim(schidr3);
if schidr7_1=schidr3(k) & schidr3(k)>0 & anymjr3(k)>=0 then do;
anymjr7_1=anymjr3(k);
major_FLG_r7=3;
end;
end;
end;
if e3112r6=-5 & e3112r5=-5 & e3112r4=-5 & e3112r3=-5 & e3112r2~=-5 then do;
do k=1 to dim(schidr2);
if schidr7_1=schidr2(k) & schidr2(k)>0 & anymjr2(k)>=0 then do;
anymjr7_1=anymjr2(k);
major_FLG_r7=2;
end;
end;
end;
if e3112r6=-5 & e3112r5=-5 & e3112r4=-5 & e3112r3=-5 & e3112r2=-5 then do;
do k=1 to dim(schidr1);
if schidr7_1=schidr1(k) & schidr1(k)>0 & anymjr1(k)>=0 then do;
anymjr7_1=anymjr1(k);
major_FLG_r7=1;
end;
end;
end;
end;

** Round 8;
do i=1 to dim(major81); if major81(i) in (0,98) & anymjr8_1~=1 then anymjr8_1=0; if major81(i)>0 & anymjr8_1~=98 then anymjr8_1=1; end;
do i=1 to dim(major82); if major82(i) in (0,98) & anymjr8_2~=1 then anymjr8_2=0; if major82(i)>0 & anymjr8_2~=98 then anymjr8_2=1; end;
do i=1 to dim(major83); if major83(i) in (0,98) & anymjr8_3~=1 then anymjr8_3=0; if major83(i)>0 & anymjr8_3~=98 then anymjr8_3=1; end;
do i=1 to dim(major84); if major84(i) in (0,98) & anymjr8_4~=1 then anymjr8_4=0; if major84(i)>0 & anymjr8_4~=98 then anymjr8_4=1; end;
if anymjr8_1=. & e3112r8~=-5 then do;
if e3112r7~=-5 then do;
do k=1 to dim(schidr7);
if schidr8_1=schidr7(k) & schidr7(k)>0 & anymjr7(k)>=0 then do;
anymjr8_1=anymjr7(k);
major_FLG_r8=7;
end;
end;
end;
if e3112r7=-5 & e3112r6~=-5 then do;
do k=1 to dim(schidr6);
if schidr8_1=schidr6(k) & schidr6(k)>0 & anymjr6(k)>=0 then do;
anymjr8_1=anymjr6(k);
major_FLG_r8=6;
end;
end;
end;
if e3112r7=-5 & e3112r6=-5 & e3112r5~=-5 then do;
do k=1 to dim(schidr5);
if schidr8_1=schidr5(k) & schidr5(k)>0 & anymjr5(k)>=0 then do;
anymjr8_1=anymjr5(k);
major_FLG_r8=5;
end;
end;
end;
if e3112r7=-5 & e3112r6=-5 & e3112r5=-5 & e3112r4~=-5 then do;
do k=1 to dim(schidr4);
if schidr8_1=schidr4(k) & schidr4(k)>0 & anymjr4(k)>=0 then do;
anymjr8_1=anymjr4(k);
major_FLG_r8=4;
end;
end;
end;
if e3112r7=-5 & e3112r6=-5 & e3112r5=-5 & e3112r4=-5 & e3112r3~=-5 then do;
do k=1 to dim(schidr3);
if schidr8_1=schidr3(k) & schidr3(k)>0 & anymjr3(k)>=0 then do;
anymjr8_1=anymjr3(k);
major_FLG_r8=3;
end;
end;
end;
if e3112r7=-5 & e3112r6=-5 & e3112r5=-5 & e3112r4=-5 & e3112r3=-5 & e3112r2~=-5 then do;
do k=1 to dim(schidr2);
if schidr8_1=schidr2(k) & schidr2(k)>0 & anymjr2(k)>=0 then do;
anymjr8_1=anymjr2(k);
major_FLG_r8=2;
end;
end;
end;
if e3112r7=-5 & e3112r6=-5 & e3112r5=-5 & e3112r4=-5 & e3112r3=-5 & e3112r2=-5 then do;
do k=1 to dim(schidr1);
if schidr8_1=schidr1(k) & schidr1(k)>0 & anymjr1(k)>=0 then do;
anymjr8_1=anymjr1(k);
major_FLG_r8=1;
end;
end;
end;
end;

** Round 9;
do i=1 to dim(major91); if major91(i) in (0,98) & anymjr9_1~=1 then anymjr9_1=0; if major91(i)>0 & anymjr9_1~=98 then anymjr9_1=1; end;
do i=1 to dim(major92); if major92(i) in (0,98) & anymjr9_2~=1 then anymjr9_2=0; if major92(i)>0 & anymjr9_2~=98 then anymjr9_2=1; end;
do i=1 to dim(major93); if major93(i) in (0,98) & anymjr9_3~=1 then anymjr9_3=0; if major93(i)>0 & anymjr9_3~=98 then anymjr9_3=1; end;
do i=1 to dim(major94); if major94(i) in (0,98) & anymjr9_4~=1 then anymjr9_4=0; if major94(i)>0 & anymjr9_4~=98 then anymjr9_4=1; end;
if anymjr9_1=. & e3112r9~=-5 then do;
if e3112r8~=-5 then do;
do k=1 to dim(schidr8);
if schidr9_1=schidr8(k) & schidr8(k)>0 & anymjr8(k)>=0 then do;
anymjr9_1=anymjr8(k);
major_FLG_r9=8;
end;
end;
end;
if e3112r8=-5 & e3112r7~=-5 then do;
do k=1 to dim(schidr7);
if schidr9_1=schidr7(k) & schidr7(k)>0 & anymjr7(k)>=0 then do;
anymjr9_1=anymjr7(k);
major_FLG_r9=7;
end;
end;
end;
if e3112r8=-5 & e3112r7=-5 & e3112r6~=-5 then do;
do k=1 to dim(schidr6);
if schidr9_1=schidr6(k) & schidr6(k)>0 & anymjr6(k)>=0 then do;
anymjr9_1=anymjr6(k);
major_FLG_r9=6;
end;
end;
end;
if e3112r8=-5 & e3112r7=-5 & e3112r6=-5 & e3112r5~=-5 then do;
do k=1 to dim(schidr5);
if schidr9_1=schidr5(k) & schidr5(k)>0 & anymjr5(k)>=0 then do;
anymjr9_1=anymjr5(k);
major_FLG_r9=5;
end;
end;
end;
if e3112r8=-5 & e3112r7=-5 & e3112r6=-5 & e3112r5=-5 & e3112r4~=-5 then do;
do k=1 to dim(schidr4);
if schidr9_1=schidr4(k) & schidr4(k)>0 & anymjr4(k)>=0 then do;
anymjr9_1=anymjr4(k);
major_FLG_r9=4;
end;
end;
end;
if e3112r8=-5 & e3112r7=-5 & e3112r6=-5 & e3112r5=-5 & e3112r4=-5 & e3112r3~=-5 then do;
do k=1 to dim(schidr3);
if schidr9_1=schidr3(k) & schidr3(k)>0 & anymjr3(k)>=0 then do;
anymjr9_1=anymjr3(k);
major_FLG_r9=3;
end;
end;
end;
if e3112r8=-5 & e3112r7=-5 & e3112r6=-5 & e3112r5=-5 & e3112r4=-5 & e3112r3=-5 & e3112r2~=-5 then do;
do k=1 to dim(schidr2);
if schidr9_1=schidr2(k) & schidr2(k)>0 & anymjr2(k)>=0 then do;
anymjr9_1=anymjr2(k);
major_FLG_r9=2;
end;
end;
end;
if e3112r8=-5 & e3112r7=-5 & e3112r6=-5 & e3112r5=-5 & e3112r4=-5 & e3112r3=-5 & e3112r2=-5 then do;
do k=1 to dim(schidr1);
if schidr9_1=schidr1(k) & schidr1(k)>0 & anymjr1(k)>=0 then do;
anymjr9_1=anymjr1(k);
major_FLG_r9=1;
end;
end;
end;
end;

** Identifying if R was enrolled in a legitimate degree program in a 2/4 year college, reported having
some major and also reported leaving that college because finished coursework or received a degree.
This dummy is created only when R does not report receiving a college degree in (YSCH-23450).
The reason we use the condition anymjrRND(i)~=0 instead of anymjrRND(i)=1 is because anymjrRND(i)
may be missing if the question about major is not asked. This question is not asked if R did not
report enrolling in any term in that round. This situation could arise if R did not receive the
degree in the round that R reported completing the last term. R then reported receiving that
degree in the single item (YSCH-3113) in the next round. As long as R did not specifically report
having no major it is ok.;
do i=1 to dim(schidr2);
if e23450r2(i)<=0 & (lftscr2(i)=1|lftsc2r2(i)=1) & scoder2(i) in (4,5)
& e27337r2(i) in (1,3,4,5,6) & anymjr2(i)~=0 then clgdgr2(i)=1;
end;
do i=1 to dim(schidr3);
if e23450r3(i)<=0 & (lftscr3(i)=1|lftsc2r3(i)=1) & scoder3(i) in (4,5)
& e27337r3(i) in (1,3,4,5,6) & anymjr3(i)~=0 then clgdgr3(i)=1;
end;
do i=1 to dim(schidr4);
if e23450r4(i)<=0 & (lftscr4(i)=1|lftsc2r4(i)=1) & scoder4(i) in (4,5)
& e27337r4(i) in (1,3,4,5,6) & anymjr4(i)~=0 then clgdgr4(i)=1;
end;
do i=1 to dim(schidr5);
if e23450r5(i)<=0 & (lftscr5(i)=1|lftsc2r5(i)=1) & scoder5(i) in (4,5)
& e27337r5(i) in (1,3,4,5,6) & anymjr5(i)~=0 then clgdgr5(i)=1;
end;
do i=1 to dim(schidr6);
if e23450r6(i)<=0 & lftscr6(i)=1 & scoder6(i) in (4,5)
& e27337r6(i) in (1,3,4,5,6) & anymjr6(i)~=0 then clgdgr6(i)=1;
end;
do i=1 to dim(schidr7);
if e23450r7(i)<=0 & lftscr7(i)=1 & scoder7(i) in (4,5)
& e27337r7(i) in (1,3,4,5,6) & anymjr7(i)~=0 then clgdgr7(i)=1;
end;
do i=1 to dim(schidr8);
if e23450r8(i)<=0 & lftscr8(i)=1 & scoder8(i) in (4,5)
& e27337r8(i) in (1,3,4,5,6) & anymjr8(i)~=0 then clgdgr8(i)=1;
end;
do i=1 to dim(schidr9);
if e23450r9(i)<=0 & lftscr9(i)=1 & scoder9(i) in (4,5)
& e27337r9(i) in (1,3,4,5,6) & anymjr9(i)~=0 then clgdgr9(i)=1;
end;

** Compute dates of degree received for respondents when they report receiving a college degree in
YSCH-3113 but do not report receiving one in YSCH-23450. In such cases, additional checks are used to
verify that the respondent has indeed received a college degree. To we use the degree working
towards (YSCH-27337), school type information (NEW_SCHOOL_CODE), reason they left the school
(NEWSCHOOL_LEFT) and whether they had decided on a major at that college. If we can verify that they
were indeed in a 2/4 year college, working towards a legitimate college degree, left that college
because they had completed coursework, or graduated and had decided on a major at that college then
we use the date of leaving that particular college as the date of receiving the college degree
reported in YSCH-3113.;
do i=1 to dim(scoder9);
if clgdgr9(i)=1 then do;
if e27337r9(i)>=1 & e3113r9=4
& aarP=-4 & barP=-4 & marP=-4 & dcrP=-4 & pfrP=-4
& aarC=-4 & barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
aarC=-3;
r9_degIMPr9=4;
aarC=stopcr9(i);
end;
if e27337r9(i)>=3 & e3113r9=5
& barP=-4 & marP=-4 & dcrP=-4 & pfrP=-4
& barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
barC=-3;
r9_degIMPr9=5;
barC=stopcr9(i);
end;
if e27337r9(i)>=4 & e3113r9=6
& marP=-4 & dcrP=-4 & pfrP=-4
& marC=-4 & dcrC=-4 & pfrC=-4 then do;
marC=-3;
r9_degIMPr9=6;
marC=stopcr9(i);
end;
if e27337r9(i)=5 & e3113r9=7 & dcrP=-4 & dcrC=-4 & e3112r9>18 then do;
dcrC=-3;
r9_degIMPr9=7;
dcrC=stopcr9(i);
end;
if e27337r9(i)=6 & e3113r9=8 & pfrP=-4 & pfrC=-4 then do;
pfrC=-3;
r9_degIMPr9=8;
pfrC=stopcr9(i);
end;
end;
end;

do i=1 to dim(scoder8);
if clgdgr8(i)=1 then do;
if e27337r8(i)>=1 & e3113r9=4
& aar8=-4 & bar8=-4 & mar8=-4 & dcr8=-4 & pfr8=-4
& aarC=-4 & barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
aarC=-3;
r9_degIMPr8=4;
aarC=stopcr8(i);
end;
if e27337r8(i)>=3 & e3113r9=5
& bar8=-4 & mar8=-4 & dcr8=-4 & pfr8=-4
& barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
barC=-3;
r9_degIMPr8=5;
barC=stopcr8(i);
end;
if e27337r8(i)>=4 & e3113r9=6
& mar8=-4 & dcr8=-4 & pfr8=-4
& marC=-4 & dcrC=-4 & pfrC=-4 then do;
marC=-3;
r9_degIMPr8=6;
marC=stopcr8(i);
end;
if e27337r8(i)=5 & e3113r9=7 & dcr8=-4 & dcrC=-4 & e3112r9>18 then do;
dcrC=-3;
r9_degIMPr8=7;
dcrC=stopcr8(i);
end;
if e27337r8(i)=6 & e3113r9=8 & pfr8=-4 & pfrC=-4 then do;
pfrC=-3;
r9_degIMPr8=8;
pfrC=stopcr8(i);
end;
end;
end;

do i=1 to dim(scoder7);
if clgdgr7(i)=1 then do;
if e27337r7(i)>=1 & e3113r9=4
& aar7=-4 & bar7=-4 & mar7=-4 & dcr7=-4 & pfr7=-4
& aar8<=-4 & bar8<=-4 & mar8<=-4 & dcr8<=-4 & pfr8<=-4
& aarC=-4 & barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
aarC=-3;
r9_degIMPr7=4;
aarC=stopcr7(i);
end;
if e27337r7(i)>=3 & e3113r9=5
& bar7=-4 & mar7=-4 & dcr7=-4 & pfr7=-4
& bar8<=-4 & mar8<=-4 & dcr8<=-4 & pfr8<=-4
& barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
barC=-3;
r9_degIMPr7=5;
barC=stopcr7(i);
end;
if e27337r7(i)>=4 & e3113r9=6
& mar7=-4 & dcr7=-4 & pfr7=-4
& mar8<=-4 & dcr8<=-4 & pfr8<=-4
& marC=-4 & dcrC=-4 & pfrC=-4 then do;
marC=-3;
r9_degIMPr7=6;
marC=stopcr7(i);
end;
if e27337r7(i)=5 & e3113r9=7 & dcr7=-4 & dcrC=-4 & e3112r9>18 then do;
dcrC=-3;
r9_degIMPr7=7;
dcrC=stopcr7(i);
end;
if e27337r7(i)=6 & e3113r9=8 & pfr7=-4 & pfrC=-4 then do;
pfrC=-3;
r9_degIMPr7=8;
pfrC=stopcr7(i);
end;
end;
end;

do i=1 to dim(scoder6);
if clgdgr6(i)=1 & (hsr6>-4|gdr6>-4) then do;
if e27337r6(i)>=1 & e3113r9=4
& aar6=-4 & bar6=-4 & mar6=-4
& aar7<=-4 & bar7<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& aar8<=-4 & bar8<=-4 & mar8<=-4 & dcr8<=-4 & pfr8<=-4
& aarC=-4 & barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
aarC=-3;
r9_degIMPr6=4;
if stopcr6(i)>0 then aarC=stopcr6(i);
end;
if e27337r6(i)>=3 & e3113r9=5
& bar6=-4 & mar6=-4
& bar7<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& bar8<=-4 & mar8<=-4 & dcr8<=-4 & pfr8<=-4
& barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
barC=-3;
r9_degIMPr6=5;
if stopcr6(i)>0 then barC=stopcr6(i);
end;
if e27337r6(i)>=4 & e3113r9=6
& mar6=-4
& mar7<=-4 & dcr7<=-4 & pfr7<=-4
& mar8<=-4 & dcr8<=-4 & pfr8<=-4
& marC=-4 & dcrC=-4 & pfrC=-4 then do;
marC=-3;
r9_degIMPr6=6;
if stopcr6(i)>0 then marC=stopcr6(i);
end;
if e27337r6(i)=5 & e3113r9=7 & dcrC=-4 & e3112r9>18 then do;
dcrC=-3;
r9_degIMPr6=7;
if stopcr6(i)>0 then dcrC=stopcr6(i);
end;
if e27337r6(i)=6 & e3113r9=8 & pfrC=-4 then do;
pfrC=-3;
r9_degIMPr6=8;
if stopcr6(i)>0 then pfrC=stopcr6(i);
end;
end;
end;

do i=1 to dim(scoder5);
if clgdgr5(i)=1 & (hsr5>-4|gdr5>-4) then do;
if e27337r5(i)>=1 & e3113r9=4 & aar5=-4 & bar5=-4 & aar6<=-4 & bar6<=-4 & mar6<=-4
& aar7<=-4 & bar7<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& aar8<=-4 & bar8<=-4 & mar8<=-4 & dcr8<=-4 & pfr8<=-4
& aarC=-4 & barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
aarC=-3;
r9_degIMPr5=4;
if stopcr5(i)>0 then aarC=stopcr5(i);
end;
if e27337r5(i)>=3 & e3113r9=5 & bar5=-4 & bar6<=-4 & mar6<=-4
& bar7<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& bar8<=-4 & mar8<=-4 & dcr8<=-4 & pfr8<=-4
& barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
barC=-3;
r9_degIMPr5=5;
if stopcr5(i)>0 then barC=stopcr5(i);
end;
if e27337r5(i)>=4 & e3113r9=6 & mar6<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& mar8<=-4 & dcr8<=-4 & pfr8<=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
marC=-3;
r9_degIMPr5=6;
if stopcr5(i)>0 then marC=stopcr5(i);
end;
if e27337r5(i)=5 & e3113r9=7 & dcrC=-4 & e3112r9>18 then do;
dcrC=-3;
r9_degIMPr5=7;
if stopcr5(i)>0 then dcrC=stopcr5(i);
end;
if e27337r5(i)=6 & e3113r9=8 & pfrC=-4 then do;
pfrC=-3;
r9_degIMPr5=8;
if stopcr5(i)>0 then pfrC=stopcr5(i);
end;
end;
end;

do i=1 to dim(scoder4);
if clgdgr4(i)=1 & (hsr4>-4|gdr4>-4) then do;
if e27337r4(i)>=1 & e3113r9=4 & aar4=-4 & bar4=-4 & aar5<=-4 & bar5<=-4
& aar6<=-4 & bar6<=-4 & mar6<=-4 & aar7<=-4 & bar7<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& aar8<=-4 & bar8<=-4 & mar8<=-4 & dcr8<=-4 & pfr8<=-4
& aarC=-4 & barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
aarC=-3;
r9_degIMPr4=4;
if stopcr4(i)>0 then aarC=stopcr4(i);
end;
if e27337r4(i)>=3 & e3113r9=5 & bar4=-4 & bar5<=-4 & bar6<=-4 & mar6<=-4
& bar7<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& bar8<=-4 & mar8<=-4 & dcr8<=-4 & pfr8<=-4
& barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
barC=-3;
r9_degIMPr4=5;
if stopcr4(i)>0 then barC=stopcr4(i);
end;
if e27337r4(i)>=4 & e3113r9=6 & mar6<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& mar8<=-4 & dcr8<=-4 & pfr8<=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
marC=-3;
r9_degIMPr4=6;
if stopcr4(i)>0 then marC=stopcr4(i);
end;
if e27337r4(i)=5 & e3113r9=7 & dcrC=-4 & e3112r9>18 then do;
dcrC=-3;
r9_degIMPr4=7;
if stopcr4(i)>0 then dcrC=stopcr4(i);
end;
if e27337r4(i)=6 & e3113r9=8 & pfrC=-4 then do;
pfrC=-3;
r9_degIMPr4=8;
if stopcr4(i)>0 then pfrC=stopcr4(i);
end;
end;
end;

do i=1 to dim(scoder3);
if clgdgr3(i)=1 & (hsr3>-4|gdr3>-4) then do;
if e27337r3(i)>=1 & e3113r9=4 & aar3=-4 & bar3=-4 & aar4<=-4 & bar4<=-4
& aar5<=-4 & bar5<=-4 & aar6<=-4 & bar6<=-4 & mar6<=-4
& aar7<=-4 & bar7<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& aar8<=-4 & bar8<=-4 & mar8<=-4 & dcr8<=-4 & pfr8<=-4
& aarC=-4 & barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
aarC=-3;
r9_degIMPr3=4;
if stopcr3(i)>0 then aarC=stopcr3(i);
end;
if e27337r3(i)>=3 & e3113r9=5 & bar3=-4 & bar4<=-4 & bar5<=-4
& bar6<=-4 & mar6<=-4 & bar7<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& bar8<=-4 & mar8<=-4 & dcr8<=-4 & pfr8<=-4
& barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
barC=-3;
r9_degIMPr3=5;
if stopcr3(i)>0 then barC=stopcr3(i);
end;
if e27337r3(i)>=4 & e3113r9=6 & mar6<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& mar8<=-4 & dcr8<=-4 & pfr8<=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
marC=-3;
r9_degIMPr3=6;
if stopcr3(i)>0 then marC=stopcr3(i);
end;
if e27337r3(i)=5 & e3113r9=7 & dcrC=-4 & e3112r9>18 then do;
dcrC=-3;
r9_degIMPr3=7;
if stopcr3(i)>0 then dcrC=stopcr3(i);
end;
if e27337r3(i)=6 & e3113r9=8 & pfrC=-4 then do;
pfrC=-3;
r9_degIMPr3=8;
if stopcr3(i)>0 then pfrC=stopcr3(i);
end;
end;
end;

do i=1 to dim(scoder2);
if clgdgr2(i)=1 & (hsr2>-4|gdr2>-4) then do;
if e27337r2(i)>=1 & e3113r9=4 & aar3<=-4 & bar3<=-4 & aar4<=-4 & bar4<=-4
& aar5<=-4 & bar5<=-4 & aar6<=-4 & bar6<=-4 & mar6<=-4
& aar7<=-4 & bar7<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& aar8<=-4 & bar8<=-4 & mar8<=-4 & dcr8<=-4 & pfr8<=-4
& aarC=-4 & barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
aarC=-3;
r9_degIMPr2=4;
if stopcr2(i)>0 then aarC=stopcr2(i);
end;
if e27337r2(i)>=3 & e3113r9=5 & bar3<=-4  & bar4<=-4 & bar5<=-4
& bar6<=-4 & mar6<=-4 & bar7<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& bar8<=-4 & mar8<=-4 & dcr8<=-4 & pfr8<=-4
& barC=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
barC=-3;
r9_degIMPr2=5;
if stopcr2(i)>0 then barC=stopcr2(i);
end;
if e27337r2(i)>=4 & e3113r9=6 & mar6<=-4 & mar7<=-4 & dcr7<=-4 & pfr7<=-4
& mar8<=-4 & dcr8<=-4 & pfr8<=-4 & marC=-4 & dcrC=-4 & pfrC=-4 then do;
marC=-3;
r9_degIMPr2=6;
if stopcr2(i)>0 then marC=stopcr2(i);
end;
if e27337r2(i)=5 & e3113r9=7 & dcrC=-4 & e3112r9>18 then do;
dcrC=-3;
r9_degIMPr2=7;
if stopcr2(i)>0 then dcrC=stopcr2(i);
end;
if e27337r2(i)=6 & e3113r9=8 & pfrC=-4 then do;
pfrC=-3;
r9_degIMPr2=8;
if stopcr2(i)>0 then pfrC=stopcr2(i);
end;
end;
end;

** If we have no or bad information about receipt of GED then we use the same technique as above to
impute the date of receipt of GED if the conditions mentioned above are satisfied. Of course, here
we do not use the restriction of having decided on a major.;
do i=1 to dim(scoder9);
if gdrC<=0 & e3113r9=2 & e23450r9(i)<=0 & lftscr9(i)=1 & scoder9(i) in (4,5) & e27337r9(i)=9
then do;
gdrC=-3;
r9_degIMPr9=2;
if stopcr9(i)>0 then gdrC=stopcr9(i);
end;
end;

** If we have no or bad information about receipt of H.S.Diploma then we use the same technique as with the GED
to impute the date of receipt of H.S.Diploma if the conditions mentioned above are satisfied.;
if hsrP<=-4 & hsrC<=0 & e3113r9=3 then do;
hsrC=-3;
r9_degIMPr9=3;
do i=1 to dim(scoder9);
if e23450r9(i)<=0 & lftscr9(i)=1 & scoder9(i) in (1,2,3) & stopcr9(i)~=. then hsrC=stopcr9(i);
end;
end;

** Taking care of missing BA/BS degree information when R enrolls in a MA/MS program in the same school
where R was enrolled in a BA/BS program.;
do i=1 to dim(schidr9);
if e23450r9(i)<=0 & e3113r9=5 & barC=-4 & scoder9(i)=5 & e27337r9(i) in (4,5,6) then do;
if e3112r8~=-5 then do;
do j=1 to dim(schidr8);
if schidr8(j)=schidr9(i) & scoder8(j)=5 & e27337r8(j)=3 & anymjr8(j)~=0 then do;
barC=-3;
r9_degIMPr8=5;
newBA=9;
end;
end;
end;
if e3112r8=-5 & e3112r7~=-5 then do;
do j=1 to dim(schidr7);
if schidr7(j)=schidr9(i) & scoder7(j)=5 & e27337r7(j)=3 & anymjr7(j)~=0 then do;
barC=-3;
r9_degIMPr7=5;
newBA=9;
end;
end;
end;
if e3112r8=-5 & e3112r7=-5 & e3112r6~=-5 then do;
do j=1 to dim(schidr6);
if schidr6(j)=schidr9(i) & scoder6(j)=5 & e27337r6(j)=3 & anymjr6(j)~=0 then do;
barC=-3;
r9_degIMPr6=5;
newBA=9;
end;
end;
end;
if e3112r8=-5 & e3112r7=-5 & e3112r6=-5 & e3112r5~=-5 then do;
do j=1 to dim(schidr5);
if schidr5(j)=schidr9(i) & scoder5(j)=5 & e27337r5(j)=3 & anymjr5(j)~=0 then do;
barC=-3;
r9_degIMPr5=5;
newBA=9;
end;
end;
end;
if e3112r8=-5 & e3112r7=-5 & e3112r6=-5 & e3112r5=-5 & e3112r4~=-5 then do;
do j=1 to dim(schidr4);
if schidr4(j)=schidr9(i) & scoder4(j)=5 & e27337r4(j)=3 & anymjr4(j)~=0 then do;
barC=-3;
r9_degIMPr4=5;
newBA=9;
end;
end;
end;
if e3112r8=-5 & e3112r7=-5 & e3112r6=-5 & e3112r5=-5 & e3112r4=-5 & e3112r3~=-5 then do;
do j=1 to dim(schidr3);
if schidr3(j)=schidr9(i) & scoder3(j)=5 & e27337r3(j)=3 & anymjr3(j)~=0 then do;
barC=-3;
r9_degIMPr3=5;
newBA=9;
end;
end;
end;
if e3112r8=-5 & e3112r7=-5 & e3112r6=-5 & e3112r5=-5 & e3112r4=-5 & e3112r3=-5 & e3112r2~=-5
then do;
do j=1 to dim(schidr2);
if schidr2(j)=schidr9(i) & scoder2(j)=5 & e27337r2(j)=3 & anymjr2(j)~=0 then do;
barC=-3;
r9_degIMPr2=5;
newBA=9;
end;
end;
end;
end;
end;
 

** Hand edits using all available information;
if pubid=3148 then do;
barC=-4;
end;
if pubid= 7186 then do;
CDTBA=308;
HE9_BA=1;
end;
if pubid= 1497 then do;
CDTMA=312;
HE9_MA=1;
end;
if pubid in (1145 3489 3595 7825) then do;
CDTBA=-3;
r9_degIMPr9=5;
end;
if pubid in (1642) then do;
CDTBA=314;
r9_degIMPr9=5;
end;
if pubid in (5790 5879) then do;
CDTBA=305;
r9_degIMPr9=5;
end;
if pubid in (7190) then do;
CDTBA=307;
r9_degIMPr9=5;
end;
if pubid in (7687) then do;
CDTBA=312;
r9_degIMPr9=5;
end;

*** Convert all -1 & -2s to -3.;
do i=1 to 7;
if CRP(i) in (-1,-2) then CRP(i)=-3;
if CRC(i) in (-1,-2) then CRC(i)=-3;
end;

*** Check if there is some conflict between information from the current round and that available from
previous rounds.;
do i=1 to 7;
if CRC(i)>0 and CRP(i)>0 & CRC(i)~=CRP(i) then FLG(i)=1;
if CRP(i)>0 and CRC(i)=-3 then FLG(i)=2;
if CRC(i)>0 and CRP(i)=-3 then FLG(i)=3;
end;

*** Merge the results from previous rounds.;
** If only one date is available for any degree i.e. there is no conflict then use that date.;
do i=1 to 7;
if FLG(i)=0 then do;
if CRP(i)~=-4 then CDT(i)=CRP(i);
if CRC(i)~=-4 then CDT(i)=CRC(i);
end;
end;
** If two dates are available for any degree from two or more rounds - to resolve the conflict:
(i) Take the date reported in the earlier round if both dates are valid. If AA or higher have two
valid dates then that is not necessarily a data or questionnaire mistake. A person may have
received the same type of degree in different majors. But it is a data inconsistency issue if R
reports receiving the same type of degree in the same major from the same institution. So these
must be looked at case by case
(ii) Only the valid date if only one of them is a valid date.;
do i=1 to 7;
if FLG(i) in (1,2) then CDT(i)=CRP(i);
if FLG(i)=3 then CDT(i)=CRC(i);
end;

*** START of Hand edits using information from all rounds;
if e3112r9~=-5 & PUBID NOT IN (3688 4248 5649 5851 6190) then do;
if grsurvR8~=-5 then do;
if HE8_GD=1 then do; CDTGD=gdr8; HE9_GD=1; end;
if HE8_HS=1 then do; CDTHS=hsr8; HE9_HS=1; end;
if HE8_AA=1 then do; CDTAA=aar8; HE9_AA=1; end;
if HE8_BA=1 then do; CDTBA=bar8; HE9_BA=1; end;
if HE8_MA=1 then do; CDTMA=mar8; HE9_MA=1; end;
end;
if grsurvR8=-5 & grsurvR7~=-5 & grsurvR6~=-5 then do;
if HE7_GD=1 then do; CDTGD=gdr7; HE9_GD=1; end;
if HE7_HS=1 then do; CDTHS=hsr7; HE9_HS=1; end;
if HE7_AA=1 then do; CDTAA=aar7; HE9_AA=1; end;
if HE7_BA=1 then do; CDTBA=bar7; HE9_BA=1; end;
if HE7_MA=1 then do; CDTMA=mar7; HE9_MA=1; end;
end;
if grsurvR8=-5 & grsurvR7=-5 & grsurvR6~=-5 then do;
if HE6_GD=1 then do; CDTGD=gdr6; HE9_GD=1; end;
if HE6_HS=1 then do; CDTHS=hsr6; HE9_HS=1; end;
if HE6_AA=1 then do; CDTAA=aar6; HE9_AA=1; end;
if HE6_BA=1 then do; CDTBA=bar6; HE9_BA=1; end;
end;
if grsurvR8=-5 & grsurvR7=-5 & grsurvR6=-5 & grsurvR5~=-5 then do;
if HE5_GD=1 then do; CDTGD=gdr5; HE9_GD=1; end;
if HE5_HS=1 then do; CDTHS=hsr5; HE9_HS=1; end;
if HE5_AA=1 then do; CDTAA=aar5; HE9_AA=1; end;
if HE5_BA=1 then do; CDTBA=bar5; HE9_BA=1; end;
end;
if grsurvR8=-5 & grsurvR7=-5 & grsurvR6=-5 & grsurvR5=-5 & grsurvR4~=-5 then do;
if HE4_GD=1 then do; CDTGD=gdr4; HE9_GD=1; end;
if HE4_HS=1 then do; CDTHS=hsr4; HE9_HS=1; end;
if HE4_AA=1 then do; CDTAA=aar4; HE9_AA=1; end;
if HE4_BA=1 then do; CDTBA=bar4; HE9_BA=1; end;
end;
if grsurvR8=-5 & grsurvR7=-5 & grsurvR6=-5 & grsurvR5=-5 & grsurvR4=-5 & grsurvR3~=-5 then do;
if HE3_GD=1 then do; CDTGD=gdr3; HE9_GD=1; end;
if HE3_HS=1 then do; CDTHS=hsr3; HE9_HS=1; end;
if HE3_AA=1 then do; CDTAA=aar3; HE9_AA=1; end;
if HE3_BA=1 then do; CDTBA=bar3; HE9_BA=1; end;
end;
if grsurvR8=-5 & grsurvR7=-5 & grsurvR6=-5 & grsurvR5=-5 & grsurvR4=-5 & grsurvR3=-5 & grsurvR2~=-5 then do;
if HE2_GD=1 then do; CDTGD=gdr2; HE9_GD=1; end;
if HE2_HS=1 then do; CDTHS=hsr2; HE9_HS=1; end;
end;
end;
if pubid in (5684 6482 6628 7632) then do;
CDTGD=-4;
FLG_13900r9=1;
HE9_GD=1;
end;
if pubid= 3397 then do;
CDTGD=248;
HE9_GD=1;
end;
if pubid= 34 then do;
CDTAA=-3;
HE9_AA=1;
end;
if pubid= 3682 then do;
CDTMA=312;
HE9_MA=1;
end;
if pubid= 1629 then do;
CDTBA=306;
HE9_BA=1;
end;
if pubid= 5128 then do;
CDTBA=304;
HE9_BA=1;
end;
if pubid= 1882 then do;
CDTAA=-4;
HE9_AA=1;
end;
if pubid in (1902 6859) then do;
CDTAA=-4;
HE9_AA=1;
end;
if pubid= 1743 then do;
CDTHS=257;
CDTAA=304;
HE9_HS=1;
HE9_AA=1;
end;
if pubid= 794 then do;
CDTBA=305;
HE9_BA=1;
end;
if pubid= 4248 then do;
CDTHS=-4;
HE9_HS=1;
end;
if pubid= 5649 then do;
CDTHS=-4;
HE9_HS=1;
end;
if pubid= 6646 then do;
CDTGD=CDTHS;
CDTHS=-4;
HE9_GD=1;
HE9_HS=1;
end;
if pubid= 438 then do;
CDTHS=-4;
HE9_HS=1;
end;
if pubid= 6896 then do;
CDTHS=-4;
HE9_HS=1;
end;
if pubid in (3011) then do;
CDTHS=-4;
HE9_HS=1;
end;
if pubid in (3501 8782 8074 6008 6307 7471 8066 6811 8862 7391)
then do;
CDTHS=-4;
HE9_HS=1;
end;
if pubid= 8432 then do; CDTHS=-4; HE9_HS=1; end;
if pubid= 7768 then do; CDTGD=-3; HE9_GD=1; end;
if pubid in (83 3332 5211 7808 8828 3028 3688 7260
8497 1472 1828 1890 3231 4150 4760 6205
6681 7049 7075 7377 8696 8942) then do;
CDTHS=-4;
HE9_HS=1;
end;

if CDTHS>-4 & CDTGD>-4 & r9_degIMPr9=3 then checkGEDHSD=1;
*** END of Hand edits;

if barP>-4 & newBA=9 then newBA=0;
if cdtBA>-3 & newBA=9 then newBA=0;

** Compute the year of receiving a degree;
do i=1 to 7;
if CDT(i)<0 then YDT(i)=CDT(i);
if 181<=CDT(i)<=192 then YDT(i)=1995;
if 193<=CDT(i)<=204 then YDT(i)=1996;
if 205<=CDT(i)<=216 then YDT(i)=1997;
if 217<=CDT(i)<=228 then YDT(i)=1998;
if 229<=CDT(i)<=240 then YDT(i)=1999;
if 241<=CDT(i)<=252 then YDT(i)=2000;
if 253<=CDT(i)<=264 then YDT(i)=2001;
if 265<=CDT(i)<=276 then YDT(i)=2002;
if 277<=CDT(i)<=288 then YDT(i)=2003;
if 289<=CDT(i)<=300 then YDT(i)=2004;
if 301<=CDT(i)<=312 then YDT(i)=2005;
if 313<=CDT(i)<=324 then YDT(i)=2006;
end;

** Compute degrees received and highest degree received variables from YSCH-23450;
hgdegr9=1;
do i=1 to 7;
DEG(i)=0;
if CDT(i)>-4 then do;
DEG(i)=1;
hgdegr9=i+1;
end;
end;

** Dummy to check if highest degree computed from YSCH-23450 and that reported in YSCH-3113 are the same;
if e3113r9=hgdegr9 & e3113r9>1 & hgdegr9>1 then do;
e3lower=0;
e3higher=0;
end;
if e3113r9~=hgdegr9 then do;
if e3113r9=1 & hgdegr9>1 then e3lower=10+hgdegr9;
if e3113r9=2 & hgdegr9>2 then e3lower=20+hgdegr9;
if e3113r9=3 & hgdegr9>3 then e3lower=30+hgdegr9;
if e3113r9=4 & hgdegr9>4 then e3lower=40+hgdegr9;
if e3113r9=5 & hgdegr9>5 then e3lower=50+hgdegr9;
if e3113r9=6 & hgdegr9>6 then e3lower=60+hgdegr9;
if e3113r9=7 & hgdegr9>7 then e3lower=70+hgdegr9;
if e3113r9=8 & hgdegr9>8 then e3lower=80+hgdegr9;
end;
if e3113r9~=hgdegr9 then do;
if hgdegr9=1 & e3113r9>1 then e3higher=10+e3113r9;
if hgdegr9=2 & e3113r9>2 then e3higher=20+e3113r9;
if hgdegr9=3 & e3113r9>3 then e3higher=30+e3113r9;
if hgdegr9=4 & e3113r9>4 then e3higher=40+e3113r9;
if hgdegr9=5 & e3113r9>5 then e3higher=50+e3113r9;
if hgdegr9=6 & e3113r9>6 then e3higher=60+e3113r9;
if hgdegr9=7 & e3113r9>7 then e3higher=70+e3113r9;
if hgdegr9=8 & e3113r9>8 then e3higher=80+e3113r9;
end;
do i=1 to dim(e23450r9);
if e23450r9(i) in (-1, -2, -3) then hgdegr9=-3; * If degree received cannot be determined;
end;

** Compute dummies for Hand edits, Flags and Questionnaire problems.;
handedit=0; flag=0; quexprb=0;
do i=1 to 7;
if HED(i)=1 then handedit=1;
if FLG(i)=1 then flag=1;
if QUX(i)=1 then quexprb=1;
end;
if FLG_COMMr9=1|FLG_13900r9=1 then flag=1;
if degIMP_round7=. & degIMP_round8=.
& (r9_degIMPr9~=.|r9_degIMPr8~=.|r9_degIMPr7~=.|r9_degIMPr6~=.|
r9_degIMPr5~=.|r9_degIMPr4~=.|r9_degIMPr3~=.) then degIMP_round9=1;

if e3113r9=3 & cdths<=-4 & cdtgd<=-4 then dscr9=1;
if e3113r9=3 & cdths<=-4 & cdtgd>-4 then dscr9=2;
if e3113r9=2 & cdtgd<=-4 & cdths<=-4 then dscr9=3;
if e3113r9=2 & cdtgd<=-4 & cdths>-4 then dscr9=4;
if e3113r9=1 & cdths<=-4 & cdtgd>-4 then dscr9=5;
if e3113r9=1 & cdtgd<=-4 & cdths>-4 then dscr9=6;
if e3113r9=1 & cdths>-4 & cdtgd>-4 then dscr9=7;

do i=1 to dim(scoder9);
if lftscr9(i)=1 & scoder9(i) in (4,5) & e27337r9(i) in (1,3,4,5,6) then do;
if e3113r9=4 & cdtAA=-4 then chkdg2=1;
if e3113r9=5 & cdtBA=-4 then chkdg2=2;
if e3113r9=6 & cdtMA=-4 then chkdg2=3;
if e3113r9=7 & cdtDC=-4 then chkdg2=4;
if e3113r9=8 & cdtPF=-4 then chkdg2=5;
end;
end;

***** Taking care of non-interviews;
if e11700r9=-5 then do;
CDTGD=-5;
CDTHS=-5;
CDTAA=-5;
CDTBA=-5;
CDTMA=-5;
CDTDC=-5;
CDTPF=-5;
hgdegr9=-5;
end;
ENDSAS;

Return to top


Number of Grades Repeated or Skipped

Variables Created: 

Variables Used

Name in Program Question Name in Data   Name in Program Question Name in Data   Name in Program Question Name in Data

Round 1 Data:

 

 

Round 9 raw data:

 

 

Round 9 raw data con't:

 

e3500r1

YSCH-3500

 

e2857r9

YSCH-2857

 

e9946r9_121

YSCH-9946.01.02.01

e3900r1

YSCH-3900

 

e3103r9

YSCH-3103

 

e9946r9_211

YSCH-9946.02.01.01

e4000r1

YSCH-4000

 

e3104r9

YSCH-3104

 

e9946r9_212

YSCH-9946.02.01.02

e5000r1

YSCH-5000

 

e3010r9

YSCH-3010

 

e9946r9_213

YSCH-9946.02.01.03

intmr1

CV_INTERVIEW_DATE1997

 

e3061r9

YSCH-3061

 

e9946r9_311

YSCH-9946.03.01.01

intyr1

CV_INTERVIEW_DATE1997

 

e3112r9

YSCH-3112

 

e9946r9_312

YSCH-9946.03.01.02

NUMREPr1

CV_GRADES_REPEAT_EVER

 

e3878r9

YSCH-3878

 

e9946r9_313

YSCH-9946.03.01.03

NUMSKIPr1

CV_GRADE_SKIPPED_EVER

 

e8416r9_11

YSCH-8416.01.01

 

e9946r9_511

YSCH-9946.05.01.01

HGCr1_symbol

COMPLETED

 

e8416r9_12

YSCH-8416.01.02

 

e10099mr9_111

YSCH-10099.01.01.01~M

 

 

 

e8416r9_21

YSCH-8416.02.01

 

e10099yr9_111

YSCH-10099.01.01.01~Y

Round 2 Data:

 

 

e8416r9_31

YSCH-8416.03.01

 

e10099mr9_112

YSCH-10099.01.01.02~M

e3104r2

YSCH-3104

 

e8416r9_41

YSCH-8416.04.01

 

e10099yr9_112

YSCH-10099.01.01.02~Y

e3061r2

YSCH-3061

 

e8416r9_51

YSCH-8416.05.01

 

e10099mr9_113

YSCH-10099.01.01.03~M

intmr2

CV_INTERVIEW_DATE1998

 

e8722r9_11

YSCH-8722.01.01

 

e10099yr9_113

YSCH-10099.01.01.03~Y

intyr2

CV_INTERVIEW_DATE1998

 

e8722r9_21

YSCH-8722.02.01

 

e10099mr9_211

YSCH-10099.02.01.01~M

NUMREPr2

CV_GRADES_REPEAT_EVER

 

e8722r9_31

YSCH-8722.03.01

 

e10099yr9_211

YSCH-10099.02.01.01~Y

NUMREPjr2

CV_GRADES_REPEAT_YR

 

e8722r9_41

YSCH-8722.04.01

 

e10099mr9_212

YSCH-10099.02.01.02~M

NUMSKIPr2

CV_GRADE_SKIPPED_EVER

 

e8722r9_51

YSCH-8722.05.01

 

e10099yr9_212

YSCH-10099.02.01.02~Y

NUMSKIPjr2

CV_GRADE_SKIPPED_YR

 

e8774mr9_11

YSCH-8774.01.01~M

 

e10099mr9_213

YSCH-10099.02.01.03~M

 

 

 

e8774yr9_11

YSCH-8774.01.01~Y

 

e10099yr9_213

YSCH-10099.02.01.03~Y

Round 3 Data:

 

 

e8774mr9_12

YSCH-8774.01.02~M

 

e10099mr9_311

YSCH-10099.03.01.01~M

e3104r3

YSCH-3104

 

e8774yr9_12

YSCH-8774.01.02~Y

 

e10099yr9_311

YSCH-10099.03.01.01~Y

e3061r3

YSCH-3061

 

e8774mr9_21

YSCH-8774.02.01~M

 

e10099mr9_312

YSCH-10099.03.01.02~M

intmr3

CV_INTERVIEW_DATE1999

 

e8774yr9_21

YSCH-8774.02.01~Y

 

e10099yr9_312

YSCH-10099.03.01.02~Y

intyr3

CV_INTERVIEW_DATE1999

 

e8977r9_11

YSCH-8977.01.01

 

e10099mr9_313

YSCH-10099.03.01.03~M

NUMREPr3

CV_GRADES_REPEAT_EVER

 

e8977r9_21

YSCH-8977.02.01

 

e10099yr9_313

YSCH-10099.03.01.03~Y

NUMREPjr3

CV_GRADES_REPEAT_YR

 

e9131r9_11

YSCH-9131.01.01

 

e10099mr9_511

YSCH-10099.05.01.01~M

NUMSKIPr3

CV_GRADE_SKIPPED_EVER

 

e9131r9_12

YSCH-9131.01.02

 

e10099yr9_511

YSCH-10099.05.01.01~Y

NUMSKIPjr3

CV_GRADE_SKIPPED_YR

 

e9131r9_21

YSCH-9131.02.01

 

pubid

PUBID

 

 

 

e9131r9_31

YSCH-9131.03.01

 

intmr9

CV_INTERVIEW_DATE2004

Round 4 Data:

 

 

e9131r9_41

YSCH-9131.04.01

 

intyr9

CV_INTERVIEW_DATE2004

e3104r4

YSCH-3104

 

e9131r9_51

YSCH-9131.05.01

 

 

 

e3061r4

YSCH-3061

 

e9335mr9_11

YSCH-9335.01.01~M

 

Round 9 roster data:

 

intmr4

CV_INTERVIEW_DATE2000

 

e9335yr9_11

YSCH-9335.01.01~Y

 

scoder9_1

NEWSCHOOL_SCHCODE.01

intyr4

CV_INTERVIEW_DATE2000

 

e9335mr9_21

YSCH-9335.02.01~M

 

scoder9_2

NEWSCHOOL_SCHCODE.02

NUMREPr4

CV_GRADES_REPEAT_EVER

 

e9335yr9_21

YSCH-9335.02.01~Y

 

scoder9_3

NEWSCHOOL_SCHCODE.03

NUMREPjr4

CV_GRADES_REPEAT_YR

 

e9335mr9_31

YSCH-9335.03.01~M

 

scoder9_4

NEWSCHOOL_SCHCODE.04

NUMSKIPr4

CV_GRADE_SKIPPED_EVER

 

e9335yr9_31

YSCH-9335.03.01~Y

 

scoder9_5

NEWSCHOOL_SCHCODE.05

NUMSKIPjr4

CV_GRADE_SKIPPED_YR

 

e9335mr9_41

YSCH-9335.04.01~M

 

strtmr9_11

NEWSCHOOL_START1.01~M

 

 

 

e9335yr9_41

YSCH-9335.04.01~Y

 

strtyr9_11

NEWSCHOOL_START1.01~Y

Round 5 Data:

 

 

e9335mr9_51

YSCH-9335.05.01~M

 

strtmr9_12

NEWSCHOOL_START1.02~M

e3104r5

YSCH-3104

 

e9335yr9_51

YSCH-9335.05.01~Y

 

strtyr9_12

NEWSCHOOL_START1.02~Y

e3061r5

YSCH-3061

 

e9589r9_111

YSCH-9589.01.01.01

 

strtmr9_13

NEWSCHOOL_START1.03~M

intmr5

CV_INTERVIEW_DATE2001

 

e9589r9_112

YSCH-9589.01.01.02

 

strtyr9_13

NEWSCHOOL_START1.03~Y

intyr5

CV_INTERVIEW_DATE2001

 

e9589r9_113

YSCH-9589.01.01.03

 

strtmr9_14

NEWSCHOOL_START1.04~M

NUMREPr5

CV_GRADES_REPEAT_EVER

 

e9589r9_121

YSCH-9589.01.02.01

 

strtyr9_14

NEWSCHOOL_START1.04~Y

NUMREPjr5

CV_GRADES_REPEAT_YR

 

e9589r9_211

YSCH-9589.02.01.01

 

strtmr9_15

NEWSCHOOL_START1.05~M

NUMSKIPr5

CV_GRADE_SKIPPED_EVER

 

e9589r9_212

YSCH-9589.02.01.02

 

strtyr9_15

NEWSCHOOL_START1.05~Y

NUMSKIPjr5

CV_GRADE_SKIPPED_YR

 

e9589r9_213

YSCH-9589.02.01.03

 

strtmr9_21

NEWSCHOOL_START2.01~M

 

 

 

e9589r9_311

YSCH-9589.03.01.01

 

strtyr9_21

NEWSCHOOL_START2.01~Y

Round 6 Data:

 

 

e9589r9_312

YSCH-9589.03.01.02

 

strtmr9_22

NEWSCHOOL_START2.02~M

e3104r6

YSCH-3104

 

e9589r9_313

YSCH-9589.03.01.03

 

strtyr9_22

NEWSCHOOL_START2.02~Y

e3061r6

YSCH-3061

 

e9589r9_511

YSCH-9589.05.01.01

 

strtmr9_31

NEWSCHOOL_START3.01~M

intmr6

CV_INTERVIEW_DATE2002

 

e9691mr9_111

YSCH-9691.01.01.01~M

 

strtyr9_31

NEWSCHOOL_START3.01~Y

intyr6

CV_INTERVIEW_DATE2002

 

e9691yr9_111

YSCH-9691.01.01.01~Y

 

strtmr9_32

NEWSCHOOL_START3.02~M

NUMREPr6

CV_GRADES_REPEAT_EVER

 

e9691mr9_112

YSCH-9691.01.01.02~M

 

strtyr9_32

NEWSCHOOL_START3.02~Y

NUMREPjr6

CV_GRADES_REPEAT_YR

 

e9691yr9_112

YSCH-9691.01.01.02~Y

 

stopmr9_11

NEWSCHOOL_STOP1.01~M

NUMSKIPr6

CV_GRADE_SKIPPED_EVER

 

e9691mr9_113

YSCH-9691.01.01.03~M

 

stopyr9_11

NEWSCHOOL_STOP1.01~Y

NUMSKIPjr6

CV_GRADE_SKIPPED_YR

 

e9691yr9_113

YSCH-9691.01.01.03~Y

 

stopmr9_12

NEWSCHOOL_STOP1.02~M

 

 

 

e9691mr9_121

YSCH-9691.01.02.01~M

 

stopyr9_12

NEWSCHOOL_STOP1.02~Y

Round 7 Data:

 

 

e9691yr9_121

YSCH-9691.01.02.01~Y

 

stopmr9_13

NEWSCHOOL_STOP1.03~M

e3104r7

YSCH-3104

 

e9691mr9_211

YSCH-9691.02.01.01~M

 

stopyr9_13

NEWSCHOOL_STOP1.03~Y

e3061r7

YSCH-3061

 

e9691yr9_211

YSCH-9691.02.01.01~Y

 

stopmr9_14

NEWSCHOOL_STOP1.04~M

intmr7

CV_INTERVIEW_DATE2003

 

e9691mr9_212

YSCH-9691.02.01.02~M

 

stopyr9_14

NEWSCHOOL_STOP1.04~Y

intyr7

CV_INTERVIEW_DATE2003

 

e9691yr9_212

YSCH-9691.02.01.02~Y

 

stopmr9_15

NEWSCHOOL_STOP1.05~M

NUMREPr7

CV_GRADES_REPEAT_EVER

 

e9691mr9_213

YSCH-9691.02.01.03~M

 

stopyr9_15

NEWSCHOOL_STOP1.05~Y

NUMREPjr7

CV_GRADES_REPEAT_YR

 

e9691yr9_213

YSCH-9691.02.01.03~Y

 

stopmr9_21

NEWSCHOOL_STOP2.01~M

NUMSKIPr7

CV_GRADE_SKIPPED_EVER

 

e9691mr9_311

YSCH-9691.03.01.01~M

 

stopyr9_21

NEWSCHOOL_STOP2.01~Y

NUMSKIPjr7

CV_GRADE_SKIPPED_YR

 

e9691yr9_311

YSCH-9691.03.01.01~Y

 

stopmr9_22

NEWSCHOOL_STOP2.02~M

 

 

 

e9691mr9_312

YSCH-9691.03.01.02~M

 

stopyr9_22

NEWSCHOOL_STOP2.02~Y

Round 8 Data:

 

 

e9691yr9_312

YSCH-9691.03.01.02~Y

 

stopmr9_31

NEWSCHOOL_STOP3.01~M

e3104r8

YSCH-3104

 

e9691mr9_313

YSCH-9691.03.01.03~M

 

stopyr9_31

NEWSCHOOL_STOP3.01~Y

e3061r8

YSCH-3061

 

e9691yr9_313

YSCH-9691.03.01.03~Y

 

stopmr9_32

NEWSCHOOL_STOP3.02~M

intmr8

CV_INTERVIEW_DATE2004

 

e9691mr9_511

YSCH-9691.05.01.01~M

 

stopyr9_32

NEWSCHOOL_STOP3.02~Y

intyr8

CV_INTERVIEW_DATE2004

 

e9691yr9_511

YSCH-9691.05.01.01~Y

 

 

 

NUMREPr8

CV_GRADES_REPEAT_EVER

 

e9793r9_111

YSCH-9793.01.01.01

 

 

 

NUMREPjr8

CV_GRADES_REPEAT_YR

 

e9946r9_111

YSCH-9946.01.01.01

 

 

 

NUMSKIPr8

CV_GRADE_SKIPPED_EVER

 

e9946r9_112

YSCH-9946.01.01.02

 

 

 

NUMSKIPjr8

CV_GRADE_SKIPPED_YR

 

e9946r9_113

YSCH-9946.01.01.03

 

 

 

 


/*Intermediate variables created in current round (R9)
ENROLL enrolled at date of interview in current round -- created
Intermediate variables created in previous round (R8)
r8bfrpev Total number of grades repeated ever up to previous round
r8bfskev Total number of grades skipped ever up to previous round
r8bf2857 HGA reported up to previous round
r8bfint The most recent interview date up to previous round (in continuous month scheme)
r8bfat1-r8bfat15 The grade attended up to previous round in order
r8bfst1-r8bfst15 The starting date for each grade attended up to previous round (in continuous month scheme)
r8bfed1-r8bfed15 The ending date for each grade attended up to previous round (in continuous month scheme)
r8bfcp1-r8bfcp15 The dummy that each grade is completed or not up to previous round */

/*As in round 4 onwards we are not using the read-in symbol variable for the first grade the youths enrolled, instead, we are using YSCH-8416.01.01. The reason for this is that, in rounds 2 and 3, we asked the question YSCH-8263 ("Is this a DLI school") and YSCH-3401("Is this the first enrollment period") if they answered "yes" to YSCH-8263. So, only the people who are not in the first enrollment period go on to question YSCH-8416.01.01. But in round 4 and 5, we don't ask the question YSCH-3401 anymore. So, even though a youth was in the first enrollment period of DLI school, we still go on to YSCH-8416.01.01. In this case, we rather use YSCH-8416.01.01 for the first grade attended than the symbol variable read in from the previous rounds. */

if e3500r1>=0 then HGAr1=e3500r1;
if e4000r1>=0 then HGAr1=e4000r1;
if e3104r2>-1 then HGAr1=e3104r2;
if e5000r1>=0 then HGCr1=e5000r1;
if HGCr1_symbol>=0 then HGCr1=HGCr1_symbol;
if e3061r2>=0 then HGCr1=e3061r2;
if e3061r2=-5 then do;
if e3061r3>=0 then HGCr1=e3061r3;
if e3061r3=-5 then do;
if e3061r4>=0 then HGCr1=e3061r4;
if e3061r4=-5 then do;
if e3061r5>=0 then HGCr1=e3061r5;
if e3061r5=-5 then do;
if e3061r6>=0 then HGCr1=e3061r6;
if e3061r6=-5 then do;
if e3061r7>=0 then HGCr1=e3061r7;
if e3061r7=-5 then do;
if e3061r8>=0 then HGCr1=e3061r8;
if e3061r8=-5 then do;
if e3061r9>=0 then HGCr1=e3061r9;
end;
end;
end;
end;
end;
end;
end;
if hsr1>-4 & hgcr1<12 then HGCr1=12;

** Interview dates in cumulative months;
if intyr9>0 & intmr9>0 then doicm=((intyr9-1980)*12)+intmr9;

** Create new array of start dates for 1st enrollment in a school depending on whether R corrected roster data;
array strtm (*) strtmr9_11 strtmr9_12 strtmr9_13 strtmr9_14 strtmr9_15 ; * Start mo from roster;
array strty (*) strtyr9_11 strtyr9_12 strtyr9_13 strtyr9_14 strtyr9_15 ; * Start yr from roster;
array e8722 (*) e8722r9_11 e8722r9_21 e8722r9_31 e8722r9_41 e8722r9_51 ; * Verify start date;
array e8774m (*) e8774mr9_11 e8774mr9_21 e8774mr9_31 e8774mr9_41 e8774mr9_51; * Corrected start mo;
array e8774y (*) e8774yr9_11 e8774yr9_21 e8774yr9_31 e8774yr9_41 e8774yr9_51; * Corrected start yr;
array startm (*) start1m start2m start3m start4m start5m ; * Correct start mo, created;
array starty (*) start1y start2y start3y start4y start5y ; * Correct start yr, created;

numstart=0;
do i=1 to dim(strtm);
if e8774m(i)>0 & e8774y(i)>0 then do;
startm(i)=e8774m(i);
starty(i)=e8774y(i);
end;
else if e8774m(i)<=0|e8774y(i)<=0|e8722(i)=1 then do;
startm(i)=strtm(i);
starty(i)=strty(i);
numstart=numstart+1;
end;
end;

** Create arrays of grades attended, whether they were completed, and start and completion dates;
* Grade attended;
array gr_attd (*) e8416r9_11 e8416r9_12 e8416r9_21 e8416r9_31 e9589r9_111 e9589r9_112 e9589r9_113
e9589r9_211 e9589r9_212 e9589r9_213 e9589r9_311 e9589r9_312 e9589r9_313;

* Completed - yes/no;
array gr_comp (*) e9131r9_11 e9131r9_12 e9131r9_21 e9131r9_31 e9946r9_111 e9946r9_112 e9946r9_113
e9946r9_211 e9946r9_212 e9946r9_213 e9946r9_311 e9946r9_312 e9946r9_313;

* Date of grade enrollment/start - month;
array sdate_m (*) start1m e8774mr9_12 start2m start3m e9691mr9_111 e9691mr9_112 e9691mr9_113
e9691mr9_211 e9691mr9_212 e9691mr9_213 e9691mr9_311 e9691mr9_312 e9691mr9_313;

* Date of grade enrollment/start - year;
array sdate_y (*) start1y e8774yr9_12 start2y start3y e9691yr9_111 e9691yr9_112 e9691yr9_113
e9691yr9_211 e9691yr9_212 e9691yr9_213 e9691yr9_311 e9691yr9_312 e9691yr9_313;

* Date of grade completion - month;
array cdate_m (*) e9335mr9_11 e9335mr9_12 e9335mr9_21 e9335mr9_31
e10099mr9_111 e10099mr9_112 e10099mr9_113 e10099mr9_211 e10099mr9_212 e10099mr9_213
e10099mr9_311 e10099mr9_312 e10099mr9_313;

* Date of grade completion - year;
array cdate_y (*) e9335yr9_11 e9335yr9_12 e9335yr9_21 e9335yr9_31
e10099yr9_111 e10099yr9_112 e10099yr9_113 e10099yr9_211 e10099yr9_212 e10099yr9_213
e10099yr9_311 e10099yr9_312 e10099yr9_313;

** Create arrays of all grades attended and completed and their start and complete dates;
* Assign GRA the number of elements in the new grades array to be created.;
GRA=9;
* Grade attended;
array attd (9) attd1-attd9;
* Grade completed;
array comp (9) comp1-comp9;
* Date of grade enrollment/start - month;
array stmo (9) stmo1-stmo9;
* Date of grade enrollment/start - year;
array styr (9) styr1-styr9;
* Date of grade completion - month;
array cpmo (9) cpmo1-cpmo9;
* Date of grade completion - year;
array cpyr (9) cpyr1-cpyr9;
** Set all new array vars to -4;
do i=1 to GRA;
stmo(i)=-4;
styr(i)=-4;
cpmo(i)=-4;
cpyr(i)=-4;
comp(i)=-4;
attd(i)=-4;
end;

** Record all grades completed and their completion dates;
j=1;
do i= 1 to dim(gr_attd);
if gr_comp(i)=1 & gr_attd(i) not in (-4,-5) then do;
comp(j)=gr_attd(i);
cpmo(j)=cdate_m(i);
cpyr(j)=cdate_y(i);
j=j+1;
end;
end;

** Record all grades attended and their start dates;
k=1;
flag1=0;
if e9131r9_11 not in (-4,-5) then do;
if e8416r9_11 not in (-4,-5) then do;
attd(k)=e8416r9_11;
if start1m>0 then stmo(k)=start1m;
if start1y>0 then styr(k)=start1y;
if e8774mr9_11=-4 & e8774yr9_11=-4 & strtmr9_11=-4 & strtyr9_11=-4 then flag1=1;
*if e8774mr9_11=-4 & e8774yr9_11=-4 & strtmr9_11=-4 & strtyr9_11=-4 & r1intyr>0
then styr(k)=r1intyr;
k=k+1;
end;
do i=2 to dim(gr_attd);
if gr_comp(i)~=-4 & gr_comp(i)~=. then do;
attd(k)=gr_attd(i);
stmo(k)=sdate_m(i);
styr(k)=sdate_y(i);
k=k+1;
end;
end;
end;

** Create date in continuous months for each start and complete date in arrays;
* Date of grade completion in continuous month scheme;
array cpcm (9) cpcm1-cpcm9;
* Date of grade enrollment/start in continuous month scheme;
array stcm (9) stcm1-stcm9;
do i=1 to GRA;
if cpyr(i)>0 & cpmo(i)>0 then cpcm(i)=((cpyr(i)-1980)*12)+cpmo(i);
else if cpyr(i) in (-1, -2, -3)|cpmo(i) in (-1, -2, -3) then cpcm(i)=-3;
else if cpyr(i)=-4|cpmo(i)=-4 then cpcm(i)=-4;
if styr(i)>0 & stmo(i)>0 then stcm(i)=((styr(i)-1980)*12)+stmo(i);
else if styr(i) in (-1, -2, -3)|stmo(i) in (-1, -2, -3) then stcm(i)=-3;
else if styr(i)=-4|stmo(i)=-4 then stcm(i)=-4;
end;

** Create new arrays of started and completed grades that have grades listed only once and in order
- report latest complete date;
* Completed grade and date of grade completion when grades have been listed only once and in order;
array NCOMP (9) NCOMP1-NCOMP9;
array NCDAT (9) NCDAT1-NCDAT9;
NCOMP1=comp1;
NCDAT1=cpcm1;
reorder=0;

** First make sure that the first element in the array is the lowest grade and the latest date for that grade;
do i=2 to GRA;
if comp(i)>0 then do;
if comp(i)=NCOMP1 & cpcm(i)>NCDAT1 then NCDAT1=cpcm(i);
else if comp(i)<NCOMP1 then do;
NCOMP1=comp(i);
NCDAT1=cpcm(i);
reorder=reorder+1;
end;
end;
end;

do j=2 to GRA;
do i=1 to GRA;
if NCOMP(j-1)~=. then do;
if comp(i)=NCOMP(j-1) & cpcm(i)>NCDAT(j-1) then NCDAT(j-1)=cpcm(i);
else if comp(i)=NCOMP(j-1)+1 then do;
NCOMP(j)=comp(i);
NCDAT(j)=cpcm(i);
end;
else if NCOMP(j)=. & comp(i)>NCOMP(j-1) then do;
NCOMP(j)=comp(i);
NCDAT(j)=cpcm(i);
reorder=reorder+1;
end;
end;
end;
end;

** Create a new array with all grades attended in order and an array with the earliest start date for each grade;
* Intermediate variables;
array tmpattd (9) tmpattd1-tmpattd9;
array tmpadat (9) tmpadat1-tmpadat9;

* Grades attended and the start dates for enrollment in these grades in proper order;
array NATTD (9) NATTD1-NATTD9;
array NADAT (9) NADAT1-NADAT9;
do i=1 to GRA;
tmpattd(i)=attd(i);
tmpadat(i)=stcm(i);
end;
i=1;
k=1;
do i=1 to GRA;
do j=i+1 to GRA;
if tmpattd(j)~=-4 then do;
if 0<tmpattd(j)<tmpattd(i) then do;
att_temp=tmpattd(i);
dat_temp=tmpadat(i);
tmpattd(i)=tmpattd(j);
tmpadat(i)=tmpadat(j);
tmpattd(j)=att_temp;
tmpadat(j)=dat_temp;
reorder=reorder+1;
end;
end;
end;
if i=1 then do;
NATTD(k)=tmpattd(i);
NADAT(k)=tmpadat(i);
end;
if tmpattd(i)=NATTD(k) then do;
if (0<tmpadat(i)<NADAT(k))|(NADAT(k)=-4 & tmpadat(i)>0) then do;
NADAT(k)=tmpadat(i);
end;
else if tmpadat(i) in (-1,-2,-3)|NADAT(k) in (-1,-2,-3) then NADAT(k)=-3;
end;
else if tmpattd(i)>NATTD(k) then do;
k=k+1;
NATTD(k)=tmpattd(i);
NADAT(k)=tmpadat(i);
end;
end;

** Compute the last enrollment date - stopdate;
* School stop date - month;
array stopm (*) stopmr9_11 stopmr9_21 stopmr9_31 stopmr9_12
stopmr9_13 stopmr9_23 stopmr9_14;

* School stop date - year;
array stopy (*) stopyr9_11 stopyr9_21 stopyr9_31 stopyr9_12
stopyr9_13 stopyr9_23 stopyr9_14;

* School stop date in continuous month scheme;
array stopd (*) stopd11 stopd21 stopd31 stopd12
stopd13 stopd23 stopd14;

* School code;
array scode (*) scoder9_1 scoder9_1 scoder9_1 scoder9_2
scoder9_3 scoder9_3 scoder9_4;

do i=1 to dim(stopm);
if stopy(i)>0 & stopm(i)>0 then stopd(i)=((stopy(i)-1980)*12)+stopm(i);
else if stopy(i)=-5 then stopd(i)=-5;
else if stopy(i) in (-1,-2,-3)|stopm(i) in (-1,-2,-3) then stopd(i)=-3;
end;

if ENROLL=0 then do;
if scoder9_1 in (1,2,3) then stopdate=stopd11;
do i=2 to dim(stopm);
if scode(i) in (1,2,3) & stopd(i)>stopdate then stopdate=stopd(i);
end;
end;
else if ENROLL=1 then stopdate=-4;

** Compute end dates for attended grades. If R doesn't give a completion date then:
(a) choose the month before they started the next grade,
(b) if there is not another grade and currently enrolled then take the interview date,
(c) if there is not another grade and not currently enrolled then take the last stop date - stopdate,
(d) if the enrollment date for the grade is the last interview date then take the next june.;

** Date of completion/stop attending a grade;
array NEDAT (9) NEDAT1-NEDAT9;
** Flags of grade completion;
array ISCOM (9) ISCOM1-ISCOM9;
do i=1 to GRA;
if NATTD(i)~=. then ISCOM(i)=0;
end;

endimp=0;
do i=1 to GRA;
do j=1 to GRA;
if NATTD(i)=NCOMP(j) & NATTD(i)>0 then do;
NEDAT(i)=NCDAT(j);
ISCOM(i)=1;
end;
end;
if NATTD(i)~=. & NEDAT(i)=. & NADAT(i)~=PRbfint & NADAT(i)~=NADAT(i+1) & NADAT(i+1)~=. then do;
NEDAT(i)=NADAT(i+1)-1;
endimp=1;
end;
else if NATTD(i)~=. & NEDAT(i)=. & NATTD(i+1)=. & ENROLL=1 then do;
NEDAT(i)=doicm;
endimp=1;
end;
else if NATTD(i)~=. & NEDAT(i)=. & NATTD(i+1)=. & ENROLL=0 then do;
NEDAT(i)=stopdate;
endimp=1;
end;
else if NEDAT(i)=. & NADAT(i)=PRbfint then do;
endimp=1;
if NADAT(i)<=210 then NEDAT(i)=210;
else if 211<=NADAT(i)<=222 then NEDAT(i)=222;
else if 223<=NADAT(i)<=234 then NEDAT(i)=234;
else if 235<=NADAT(i)<=246 then NEDAT(i)=246;
else if 247<=NADAT(i)<=258 then NEDAT(i)=258;
else if 259<=NADAT(i)<=270 then NEDAT(i)=270;
else if 271<=NADAT(i)<=282 then NEDAT(i)=282;
else if 283<=NADAT(i)<=294 then NEDAT(i)=294;
else if 295<=NADAT(i)<=306 then NEDAT(i)=306;
else if 307<=NADAT(i)<=318 then NEDAT(i)=318;
else if 319<=NADAT(i)<=330 then NEDAT(i)=330;
end;
end;

** Delete the grades whose information is repeatedly reported in the current round: If a grade is
reported in the previous rounds and was completed, don't repeat this grade's info. in this round;
* Assign GRB the number of elements in this array of grades.;
GRB=15;
* The grade attended up to the previous round in order;
array PRbfat (15) PRbfat1-PRbfat15;
* Enrollment dates for grade attended up to the previous round in order;
array PRbfst (15) PRbfst1-PRbfst15;
* Stop dates for grade attended up to the previous round in order;
array PRbfed (15) PRbfed1-PRbfed15;
* Flag to indicate whether the grade was completed or not for grades attended up to the previous round in order;
array PRbfcp (15) PRbfcp1-PRbfcp15;
* Intermediate variables;
array tmp2att (9) tmp2att1-tmp2att9;

do i=1 to GRA;
tmp2att(i)=NATTD(i);
end;

backcut=0;
ncut=0;
backrep=0;

do i=1 to GRA;
do j=1 to GRB;
if 0<tmp2att(i)<13 & tmp2att(i)=PRbfat(j) & PRbfcp(j)=1 then do;
j=GRB;
backcut=1;
ncut=ncut+1;
do k=i+1-ncut to GRA-ncut;
if NATTD(k+1)~=. then do;
NATTD(k)=NATTD(k+1);
NADAT(k)=NADAT(k+1);
NEDAT(k)=NEDAT(k+1);
ISCOM(k)=ISCOM(k+1);
end;
else do;
NATTD(k)=.;
NADAT(k)=.;
NEDAT(k)=.;
ISCOM(k)=0;
k=GRA-ncut;
end;
end;
end;
end;
end;

if 0<NATTD1<13 then do;
do i=1 to GRB;
if PRbfat(i)>=NATTD1 then do;
if PRbfat(i+1)~=. then backrep=1;
if PRbfcp(i)=1 then backrep=2;
end;
end;
end;

** Flag the case where the reported grades are jumping;
badpre=0;
replace=0;
jumprep1=0;
jumprep2=0;
jumpge21=0;
jumpge22=0;

if PRbfat1~=. then do;
do i=1 to (GRB-1);
if PRbfat(i)~=. & PRbfat(i+1)=. then do;
lphigh=PRbfat(i);
lphighst=PRbfst(i);
lphighed=PRbfed(i);
lphighcp=PRbfcp(i);
lpnum=i;
i=GRB;
end;
end;
end;
else lphigh=-5;

if 0<NATTD1<13 then do;
if (lphigh~=-5 & ((NATTD1=lphigh+1 & lphighcp~=1)|NATTD1>lphigh+1)) then jumprep1=1;
if (lphigh=-5 & ((HGCr1>0 & NATTD1>=HGCr1+2)|(HGAr1>0 & NATTD1>=HGAr1+2))) then jumprep2=1;
if (lphigh~=-5 & NATTD1>=lphigh+2) then jumpge21=1;
if (lphigh=-5 & HGCr1>0 & NATTD1>=HGCr1+3) then jumpge22=1;
end;

** Substitute start dates in the previous round for first grade in loops;
if 0<NATTD1<13 & PRbfat1~=. then do;
do i=1 to (GRB-1);
if (PRbfst(i)>PRbfed(i) & PRbfed(i)>0) or (PRbfed(i)>PRbfst(i+1) & PRbfst(i+1)>0)
or (PRbfst(i+1)>PRbfed(i+1) & PRbfed(i+1)>0) then do;
NADAT1=-3;
badpre=1;
end;
else if PRbfat(i)=NATTD1 & PRbfat(i+1)=. & PRbfcp(i)=0 & badpre~=1 then do;
NADAT1=PRbfst(i);
replace=1;
end;
end;
end;
else if -4<NATTD1<=0 then NADAT1=-3;

***** CREATE THE FINAL VARIABLES;
** Measure the length that a respondent was in each completed grade and count the number of grades skipped and repeated;
array lengtha (9) length1-length9;
REPEAT=0;
REPEATj=0;
skipleng=0;
skipl_j=0;
SKIP=-16;
SKIPj=-16;
oldstrt=0;
nocomp=0;

do i=1 to (GRA-1);
if 0<NATTD(i)<13 & NEDAT(i)>0 & NADAT(i)>0 then lengtha(i)=NEDAT(i)-NADAT(i);
if 0<NATTD(i)<13 & NADAT(i)<=NEDAT(i)<=NADAT(i+1) & lengtha(i)>13
& NATTD(i+1)-NATTD(i)=1 & REPEAT~=-3 then do;
REPEAT=REPEAT+1;
if i=1 & NADAT(i)<PRbfint then oldstrt=1;
if NEDAT(i)<=306 then REPEATj=REPEATj+1;
end;
else if 0<NATTD(i)<13 & NADAT(i)<=NEDAT(i) & NATTD(i+1)=. & lengtha(i)>13
& REPEAT~=-3 & (ISCOM(i)=1|e2857r9=NATTD(i)) then do;
REPEAT=REPEAT+1;
if i=1 & NADAT(i)<PRbfint then oldstrt=1;
if NEDAT(i)<=306 then REPEATj=REPEATj+1;
end;
else if 0<NATTD(i)<13 & NADAT(i)<=NEDAT(i) & NATTD(i+1)=. & lengtha(i)>13
& REPEAT~=-3 & (ISCOM(i)=0 & e2857r9~=NATTD(i)) then do;
if i=1 & NADAT(i)<PRbfint then oldstrt=1;
REPEAT=-3;
REPEATj=-3;
reason=1;
end;
end;

do i=1 to (GRA-2);
if 0<NATTD(i)<13 & NADAT(i)<NEDAT(i)<NADAT(i+1)<NEDAT(i+1) then do;
if NADAT(i) in (212,213,224,225,236,237,248,249,260,261,272,273,284,285,296,297,308,309)
& NADAT(i)~=PRbfint & NATTD(i+1)-NATTD(i)=1 & ISCOM(i+1)=1
& NEDAT(i+1)-NADAT(i)<=12 & NADAT(i+2)-NEDAT(i+1)<=9 then do;
if (i=1|(i~=1 & NADAT(i)-NEDAT(i-1)<=9)) & skipleng~=-3 then do;
skipleng=skipleng+1;
if NEDAT(i+1)<=294 & skipl_j~=-3 then skipl_j=skipl_j+1;
end;
end;
end;
end;

** Take care of connection between previous round and current round;
connect=0;
if 0<NATTD1<13 & lphigh>0 & NATTD1~=lphigh then do;
if NATTD1-lphigh>1 then connect=1;
if lphighst in (212,213,224,225,236,237,248,249,260,261,272,273,284,285,296,297,308,309)
& NEDAT1>=lphighst & NEDAT1-lphighst<=12 then connect=2;
end;
else if 0<NATTD1<13 & lphigh>0 & NATTD1=lphigh & ISCOM1=1 & lphighcp~=1
& PRbfst(lpnum)>0 then do;
if PRbfst(lpnum) in (212,213,224,225,236,237,248,249,260,261,272,273,284,285,296,297,308,309)
& NEDAT1>=PRbfst(lpnum) & NEDAT1-PRbfst(lpnum)<=12 then connect=3;
end;

** Check for respondents who completely skip (do not attend) a grade;
skipgr=0;
skipgrj=0;
skipgt2=0;

do i=1 to (GRA-1);
if 0<NATTD(i)<13 & NATTD(i+1)-NATTD(i)=2 & NEDAT(i)>0 & NADAT(i+1)>0
& NADAT(i+1)-NEDAT(i)<=9 & skipgr~=-3 then do;
skipgr=skipgr+1;
if NEDAT(i+1)<=306 then skipgrj=skipgrj+1;
end;
else if 0<NATTD(i)<13 & NATTD(i+1)-NATTD(i)=3 & NEDAT(i)>0 & NADAT(i+1)>0
& NADAT(i+1)-NEDAT(i)<=9 then do;
skipgr=skipgr+2;
if NEDAT(i+1)<=306 then skipgrj=skipgrj+2;
end;
else if 0<NATTD(i)<13 & NATTD(i+1)-NATTD(i)>3 & NEDAT(i)>0 & NADAT(i+1)>0
& NADAT(i+1)-NEDAT(i)<=9 then do;
skipgt2=1;
end;
end;

** Set REPEAT and SKIP to -3 if allmess=1 or backrep>0 or jumprep=1 or zerograd=1 or negdate=1;
allmess=0;
do i=1 to (GRA-1);
if 0<NATTD(i)<13 & ((NADAT(i)>NEDAT(i) & NEDAT(i)>0) |(NEDAT(i)>NADAT(i+1) & NADAT(i+1)>0)
|(NADAT(i+1)>NEDAT(i+1) & NEDAT(i+1)>0)) then do;
allmess=1;
end;
end;

zerograd=0;
do i=1 to GRA;
if NATTD(i)=0 then zerogrd=1;
end;

negdate=0;
do i=1 to dim(attd);
if 0<NATTD(i)<13 & (NEDAT(i) in (-1,-2,-3)|NADAT(i) in (-1,-2,-3)) then negdate=1;
end;

if allmess=1|backrep>0|zerograd=1|jumprep1=1|jumprep2=1|negdate=1 then do;
REPEAT=-3;
REPEATj=-3;
SKIP=-3;
SKIPj=-3;
end;

if allmess=1 then reason=2.1;
if backrep>0 then reason=2.2;
if zerograd=1 then reason=2.3;
if jumprep1=1 then reason=2.4;
if jumprep2=1 then reason=2.5;
if negdate=1 then reason=2.6;

** Flag respondents who reported skipping a grade and those who say they did not skip grade;
array whyskip (*) e8977r9: e9793r9:;
skipques=0;
do i=1 to dim(whyskip);
if whyskip(i)=1 then skipques=1;
end;

notskip=0;
do i=1 to dim(whyskip);
if whyskip(i) in (-1,-2,2,999) then notskip=1;
end;

double=0;
if skipgr>0 & skipleng>0 then double=1;

if SKIP~=-3 then do;
if (skipques=0 & skipleng=0 & skipgr=0)|(notskip>=1 & skipques=0) then SKIP=0;
else if skipleng=-3 & (skipgr=0|skipques=0) then do;
SKIP=-3;
reason=3;
end;
else if skipgr=-3 & skipleng=0 then do;
SKIP=-3;
reason=4;
end;
else if skipleng>=1 then SKIP=skipleng;
else if skipques>=1 & skipgr>=1 then SKIP=skipgr;

else if skipques>=1 & skipgr=0 then do;
SKIP=-3;
reason=5;
end;
else if skipques=0 & skipgr>=1 then do;
SKIP=-3;
reason=6;
end;
if skipques=-3|skipgr=-3|skipleng=-3 then do;
SKIP=-3;
reason=7;
end;
end;

if SKIPj~=-3 then do;
if (skipl_j=0 & skipgrj=0)|(notskip>=1 & skipques=0) then SKIPj=0;
else if skipl_j=-3 & (skipgrj=0|skipques=0) then do;
SKIP=-3;
reason=8;
end;
else if skipgrj=-3 & skipl_j=0 then do;
SKIPj=-3;
reason=9;
end;
else if skipl_j>=1 then SKIPj=skipl_j;
else if skipques>=1 & skipgrj>=1 then SKIPj=skipgrj;

else if skipques>=1 & skipgrj=0 then do;
SKIPj=-3;
reason=10;
end;
else if skipques=0 & skipgrj>=1 then do;
SKIPj=-3;
reason=11;
end;
if SKIP=-3 then do;
SKIPj=-3;
reason=12;
end;
end;

** Take care of the cases whose "repeated grade" could be double counted;
if oldstrt=1 & REPEAT>0 & PRbfrpev>0 & PRbf2857~=-5 then do;
do i=1 to (GRA-1);
if 0<NATTD1<13 & PRbfat(i)=NATTD1 & PRbfat(i+1)=. & (PRbfed(i)-PRbfst(i))>13 &
(PRbfcp(i)=1|PRbf2857=PRbfat(i)) then do;
REPEAT=REPEAT-1;
if NEDAT1<=306 then REPEATj=REPEATj-1;
double_repeat=1;
end;
end;
end;

* HAND EDITS;
* Combine previous and current round information.;
if PRbfrpev>=0 & REPEAT>=0 then NUMREP=PRbfrpev+REPEAT;
else if PRbfrpev<0 then NUMREP=PRbfrpev;
else if PRbfrpev>=0 & REPEAT<0 then NUMREP=REPEAT;

if PRbfrpev>=0 & REPEATj>=0 then NUMREPj=PRbfrpev+REPEATj;
else if PRbfrpev<0 then NUMREPj=PRbfrpev;
else if PRbfrpev>=0 & REPEATj<0 then NUMREPj=REPEATj;

if PRbfskev>=0 & SKIP>=0 then NUMSKIP=PRbfskev+SKIP;
else if PRbfskev<0 then NUMSKIP=PRbfskev;
else if PRbfskev>=0 & SKIP<0 then NUMSKIP=SKIP;

if PRbfskev>=0 & SKIP>=0 then NUMSKIPj=PRbfskev+SKIPj;
else if PRbfskev<0 then NUMSKIPj=PRbfskev;
else if PRbfskev>=0 & SKIPj<0 then NUMSKIPj=SKIPj;

if NUMREP in (-1,-2) then NUMREP=-3;
if NUMREPj in (-1,-2) then NUMREPj=-3;
if NUMSKIP in (-1,-2) then NUMSKIP=-3;
if NUMSKIPj in (-1,-2) then NUMSKIPj=-3;

if NUMREPr1=-4 then do;
NUMSKIP=-4;
NUMREP=-4;
NUMSKIPj=-4;
NUMREPj=-4;
end;

dontbother=1;
if NUMREP not in (-3,-4) & NUMSKIP not in (-3,-4)
& PRbfrpev not in (-3,-4) & PRbfskev not in (-3,-4) then dontbother=0;

if e3104r9=-5 then do;
NUMSKIP=-5;
NUMREP=-5;
NUMSKIPj=-5;
NUMREPj=-5;
end;

***** GENERATE THE DATA SET containing the carry on variables for the current round - CRbf....;
** For single variables;
CRbfrpev=NUMREP;
if e3104r9=-5 then CRbfrpev=PRbfrpev;
CRbfskev=NUMSKIP;
if e3104r9=-5 then CRbfskev=PRbfskev;
CRbf2857=e2857r9;
if e3104r9=-5 then CRbf2857=PRbf2857;
CRbfint=doicm;
if e3104r9=-5 then CRbfint=PRbfint;

** For array variables;
array alattd (*) PRbfat1-PRbfat15 NATTD1-NATTD9;
array alstdt (*) PRbfst1-PRbfst15 NADAT1-NADAT9;
array aleddt (*) PRbfed1-PRbfed15 NEDAT1-NEDAT9;
array alcomp (*) PRbfcp1-PRbfcp15 ISCOM1-ISCOM9;
array CRbfat (*) CRbfat1-CRbfat15;
array CRbfst (*) CRbfst1-CRbfst15;
array CRbfed (*) CRbfed1-CRbfed15;
array CRbfcp (*) CRbfcp1-CRbfcp15;
array PRtpat (*) PRtpat1-PRtpat15;
array PRtpst (*) PRtpst1-PRtpst15;
array PRtped (*) PRtped1-PRtped15;
array PRtpcp (*) PRtpcp1-PRtpcp15;

GRC=(GRA+GRB);
j=0;
do i=1 to GRC;
if alattd[i] not in (-4, -5, .) then do;
j=j+1;
CRbfat[j]=alattd[i];
CRbfst[j]=alstdt[i];
CRbfed[j]=aleddt[i];
CRbfcp[j]=alcomp[i];
end;
end;

do i=1 to GRB;
PRtpat[i]=CRbfat[i];
PRtpst[i]=CRbfst[i];
PRtped[i]=CRbfed[i];
PRtpcp[i]=CRbfcp[i];
end;

** If two grades are same with the same start date, we delete the info. with earlier stopping date;
** We also delete the 0 grade info;
cut=0;
numcut=0;
samegrd=0;
do i=1 to (GRB-1);
if (0<PRtpat[i]<13 & PRtpat[i]=PRtpat[i+1] & PRtpst[i]=PRtpst[i+1] & PRtped[i]<=PRtped[i+1]
& (PRtpst[i]~=-3|PRtpst[i+1]~=-3))|PRtpat[i]=0 then do;
cut=1;
cut=1;
numcut=numcut+1;
do k=i+1-numcut to GRB-numcut;
CRbfat[k]=CRbfat[k+1];
CRbfst[k]=CRbfst[k+1];
CRbfed[k]=CRbfed[k+1];
CRbfcp[k]=CRbfcp[k+1];
end;
end;
else if 0<PRtpat[i]<13 & PRtpat[i]=PRtpat[i+1] & PRtpst[i]=PRtpst[i+1] & PRtped[i]>=PRtped[i+1]
& (PRtpst[i]~=-3|PRtpst[i+1]~=-3) then do;
cut=2;
numcut=numcut+1;
do k=i+2-numcut to GRB-numcut;
CRbfat[k]=CRbfat[k+1];
CRbfst[k]=CRbfst[k+1];
CRbfed[k]=CRbfed[k+1];
CRbfcp[k]=CRbfcp[k+1];
end;
end;
else if 0<PRtpat[i]<13 & PRtpat[i]=PRtpat[i+1] & PRtpst[i]~=PRtpst[i+1] then samegrd=1;
end;

** Flag the special cases;
strtneg=0; endneg=0;
do i=1 to GRB;
if 0<CRbfat[i]<13 & CRbfst[i]=-3 then strtneg=1;
if 0<CRbfat[i]<13 & CRbfed[i]=-3 then endneg=1;
if 12<CRbfat[i]<95 then clg=1;
end;
neg3or4=0;
if (CRbfrpev in (-1,-2,-3) & CRbfskev in (-1,-2,-3))|(CRbfrpev=-4 & CRbfskev=-4) then neg3or4=1;
gapbteq=0;
do i=1 to (GRB-2);
do k=i+2 to GRB;
if 0<CRbfat[i]<13 & CRbfat[i]=CRbfat[k] then gapbteq=1;
end;
end;
gapbteqPR=0;
do i=1 to (GRB-2);
do k=i+2 to GRB;
if 0<alattd[i]<13 & alattd[i]=alattd[k] then gapbteqPR=1;
end;
end;
gapbteqCR=0;
do i=(GRB+1) to (GRC-2);
do j=i+2 to GRC;
if 0<alattd(i)<13 & alattd(i)=alattd(j) then gapbteqCR=1;
end;
end;
strtmis=0; endmis=0;
do i=1 to GRB;
if 0<CRbfat[i]<13 & CRbfst[i] in (-4,.) then strtmis=1;
if 0<CRbfat[i]<13 & CRbfed[i] in (-4,.) then endmis=1;
end;

array vars9 r9bfrpev r9bfskev r9bf2857 r9bfint r9bfat1-r9bfat15 r9bfat1-r9bfat15
r9bfst1-r9bfst15 r9bfst1-r9bfst15 r9bfed1-r9bfed15 r9bfed1-r9bfed15
r9bfcp1-r9bfcp15 r9bfcp1-r9bfcp15;
array varsC CRbfrpev CRbfskev CRbf2857 CRbfint CRbfat1-CRbfat15 CRbfat1-CRbfat15
CRbfst1-CRbfst15 CRbfst1-CRbfst15 CRbfed1-CRbfed15 CRbfed1-CRbfed15
CRbfcp1-CRbfcp15 CRbfcp1-CRbfcp15;
do over varsC;
vars9=varsC;
end;

ENDSAS;


Return to top

Number of Schools Attended

Variables Created:

Variables Used

Name in Program Question Name in Data   Name in Program Question Name in Data

e3500r1

YSCH_3500

 

schidr9_1-_4

NEWSCHOOL_PUBID.01-.04

e2857r2-e2857r9

YSCH_2857 (rounds 2-9)

 

strtmr9_11

NEWSCHOOL_START1.01~M

e3112r9

YSCH_3112

 

strtyr9_11

NEWSCHOOL_START1.01~Y

NUMR1-NUMR8

CV_SCH_ATTEND_EVER (rounds 1-8)

 

strtmr9_12

NEWSCHOOL_START1.02~M

e8416r9_11

YSCH-8416.01.01

 

strtyr9_12

NEWSCHOOL_START1.02~Y

e8416r9_12

YSCH-8416.01.02

 

strtmr9_13

NEWSCHOOL_START1.03~M

e8416r9_21

YSCH-8416.02.01

 

strtyr9_13

NEWSCHOOL_START1.03~Y

e8416r9_31

YSCH-8416.03.01

 

strtmr9_14

NEWSCHOOL_START1.04~M

e9589r9_111-_113

YSCH-9589.01.01.01-.03

 

strtyr9_14

NEWSCHOOL_START1.04~Y

e9589r9_211-_213

YSCH-9589.02.01.01-.03

 

GRSURV

CV_HGC_EVER (2005)

e9589r9_311-_313

YSCH-9589.03.01.01-.03

 

ENCAT

CV_ENROLLSTAT (2005)

schintr9_1-_4

NEWSCHOOL_INTERVIEW.01-.04

 

 

 

 This program is used to count the number of regular schools that the youth ever attended as of the survey date and as of June 30, 2005.


** The program first counts the number of new regular ** schools that the youth attended since DLI to the date of survey or by June 30, 2005 using the
first enrollment date in each new school. Then, it adds this number to the created variable in the last interview round and computes the total number of
regular schools that the youth has ever attended up to the required date. When we count the new schools, since we only count the schools from the 7th
grade through the 12th grade, we need to check if the Respondents did go to these  grades in the new school before we count that school. **
** **
** If there was not a parent interview in R1, we lack information on the number of  schools attended prior to R1 (if they were enrolled in a grade>7 in R1).
Those respondents receive a -4 in all rounds for the CVs. **
** **
** NOTE: Unlike rounds 2-3, in round 4 no grade was read in from previous rounds (in prior programs this variable is called "symgrd" and comes from
symbol!Cur!Firstgrade.01.01).  Round 4 onwards the first grade from the loop question (e8416_11) is used where "symgrd" was used in the past. **
*******************************************************************************************************/

** Grades attended in each school;
array gratnd (3,5) e8416r9_11 e8416r9_12 e9589r9_111-e9589r9_113 e8416r9_21 e8416r9_22 e9589r9_211-e9589r9_213
e8416r9_31 e8416r9_32 e9589r9_311-e9589r9_313;

** Enrollment start dates at each school;
array startm (*) strtmr9_11-strtmr9_13;
array starty (*) strtyr9_11-strtyr9_13;
array stopm (*) stopmr9_11-stopmr9_13;
array stopy (*) stopyr9_11-stopyr9_13;
array start (*) start1-start3;

** The round R first reported each school;
array schint (*) schintr9_1-schintr9_3;

** Pubid for each school;
array schid (*) schidr9_1-schidr9_3;

** Dummy variables used in the program;
array DUMGRD (*) DUMGRD1-DUMGRD3;
array AGAIN (*) AGAIN1-AGAIN3;

** Create DUMGRD: Dummy variable to indicate whether R attended grades 7 - 12 in each school.;
do i=1 to dim(gratnd,1);
DUMGRD(i)=0;
do j=1 to dim(gratnd,2);
if DUMGRD(i)~=1 & -3<=gratnd(i,j)<=-1 then DUMGRD(i)=-3;
if 7<=gratnd(i,j)<=12 then DUMGRD(i)=1;
end;
end;

** Create AGAIN: Dummy variable to indicate whether R reported attending the school more than once.;
do i=1 to dim(schid);
AGAIN(i)=0;
do j=i+1 to dim(schid);
if schid(i)>0 and DUMGRD(i)=1 & DUMGRD(j)=1 & schid(i)=schid(j) then AGAIN(i)=1;
end;
end;

** Calculate the accumulated month of the enrollment start date.;
do i=1 to dim(schid);
if starty(i)>0 and startm(i)>0 then start(i)=12*(starty(i)-1980)+startm(i);
end;

** Next, calculate prenum.;
prenum=0; numjr9=0; numr9=0;
if NUMR8>0 then prenum=NUMR8;
if NUMR8 in (-4, -5) then do;
if NUMR7>0 then prenum=NUMR7;
if NUMR7 in (-4, -5) then do;
if NUMR6>0 then prenum=NUMR6;
if NUMR6 in (-4, -5) then do;
if NUMR5>0 then prenum=NUMR5;
if NUMR5 in (-4, -5) then do;
if NUMR4>0 then prenum= NUMR4;
if NUMR4 in (-4, -5) then do;
if NUMR3>0 then prenum= NUMR3;
if NUMR3 in (-4, -5) then do;
if NUMR2>0 then prenum= NUMR2;
if NUMR2 in (-4, -5) and NUMR1>0 then prenum=NUMR1;
end;
end;
end;
end;
end;
end;

** Count the new schools R was enrolled in grades 7 thru 12 - numjr9 and numr9.;
do i=1 to dim(schid);
if schint(i)=9 & AGAIN(i)=0 & DUMGRD(i)=1 then do;
numr9=numr9+1;
if 0<start(i)<=306|0<starty(i)<2005 then numjr9=numjr9+1;
end;
end;

do i=1 to dim(schid);
if -3<=schint(i)<=-1 then do;
numr9=-3;
numjr9=-3;
end;
end;

** If the respondent is not interviewed in Round 8 and has no number of schools info. in previous
schints, or if number of school info. in round 8 is in (0,-4), then count all the schools. That is,
for these people, the above count will be overwritten.;
flagprev=0;
if (numr8=-5 & numr7 in (0,-4,-5) & numr6 in (0,-4,-5) & numr5 in (0,-4,-5)
& numr4 in (0,-4,-5) & numr3 in (0,-4,-5) & numr2 in (0,-4,-5) & numr1 in (0,-4)) then do;
numr9=0;
numjr9=0;
flagprev=1;
do i=1 to dim(schid);
if DUMGRD(i)=1 & AGAIN(i)=0 then do;
numr9=numr9+1;
if 0<start(i)<=306|0<starty(i)<2005|(schint(i) in (1,2,3,4,5,6,7,8))
then numjr9=numjr9+1;
end;
end;
end;

** If grades enrolled in each school cannot be determined.;
do i=1 to dim(schid);
if DUMGRD(i)=-3 & schint(i)=9 then do;
numr9=-3;
numjr9=-3;
end;
end;

** If schools are reported in round 9, but with bad enrollment start dates.;
do i=1 to dim(schid);
if schint(i)=9 & AGAIN(i)=0 & DUMGRD(i)=1 & ((starty(i)=2005 & -4<startm(i)<0)|(-4<starty(i)<0))
& (-4<stopy(i)<0|(stopy(i)>2004 & -4<stopm(i)<0)|(stopy(i)=2005 & stopm(i)>6)|(stopy(i)>2005))
then numjr9=-3;
end;

** We then add the above two numbers to the corresponding variables from round 1 to round 8.;
if numjr9>=0 then NUMJ=numjr9+prenum;
if numr9>=0 then NUMS=numr9+prenum;

** For the youths who didn't answer the number of schools in round 1, we distinguish them into three cases:
1) If the 'grade currently attended' in round 1 is <=7 and the 'highest grade attended' in round 9 >= 7,
we use the number from round 9 as the total number.
2) If both the 'grade currently attended' in round 1 and the 'highest grade attended' in round 9 are <7,
we use -4 for the total number.
3) If the 'grade currently attended' in round 1 >7, we use -4 for the total number.;
if numr1 in (0,-4) & numr2=-5 & numr3=-5 & numr4=-5 & numr5=-5 & numr6=-5 & numr7=-5 & numr8=-5 then do;
if e3500r1<=7 then do;
NUMJ=NUMJR9;
NUMS=NUMR9;
end;
if e3500r1<7 & e2857r9<7 then do;
NUMJ=-4;
NUMS=-4;
end;
end;
if numr1 in (-4,0) and e3500r1>7 then do;
NUMS=-4;
NUMJ=-4;
end;
if (-3<=numr1<=-1)|(-3<=numr2<=-1)|numr3=-3|numr4=-3|numr5=-3|numr6=-3|numr7=-3|numr8=-3|numr9=-3 then do;
NUMJ=-3;
NUMS=-3;
end;
if numjr9=-3 then NUMJ=-3;

** Respondents incorrectly report "year of college" instead of "number of years of school";
if e2857r9<7 then do;
if e3112r9>12 & e2857r9+12>=e3112r9 then hgachk=1;
if GRSURV>=12 & ENCAT in (4,5,6,7,9,10,11) then hgachk=1;
end;

if e2857r9<7 & hgachk~=1 then do;
NUMJ=-4;
NUMS=-4;
end;

** Check these cases and hand edit them;
if NUMS<numr8 & numr8~=-5 & e8416r9_11~=-5 & NUMS~=-3 then do;
flagcheck=1;
end;
if pubid in (2311 2720 6843 6844 7737) then do;
NUMS=prenum;
NUMJ=prenum;
HE_num=1;
end;

if e8416r9_11=-5 then do;
numjr9=-5;
numr9=-5;
NUMJ=-5;
NUMS=-5;
end;

if encatP in (2,3,4,5,6,7,9,10,11) & prenum~=NUMS & NUMS~=-3 & numr1~=-4 & NUMS~=-5 then chk1=1;
if pubid in (409 4795) then do;
NUMS=prenum;
NUMJ=prenum;
HE_num=1;
end;

** Collapsed variables;
array ns (*) NUMr1-NUMr8 NUMS;
do i=1 to 9;
if ns(i)~=-5 then CNUMS=ns(i);
end;

endsas;


Return to top


Total Fraction of Credits Earned towards Bachelors/Associate Degree

Variables Created: 

Variables Used

Name in Program Question Name in Data   Name in Program Question Name in Data

Prior Round Variables

 

 

Prior Round Variables con't

 

asctr1_1

CV_ASSOC_CREDITS

 

e27388r7_1-_5

YSCH-27388.01-.05

bactr1_1

CV_BA_CREDITS

 

schidr7_1-_5

NEWSCHOOL_PUBID.01-.05

e27388r2_1-_5

YSCH-27388.01-.05

 

asctr7_1-_5

CV_ASSOC_CREDITS.01-.05

schidr2_1-_6

NEWSCHOOL_PUBID.01-.06

 

bactr7_1-_5

CV_BA_CREDITS.01-.05

asctr2_1-_5

CV_ASSOC_CREDITS.01-.05

 

e27388r8_1-_4

YSCH-27388.01-.04

bactr2_1-_5

CV_BA_CREDITS.01-.05

 

schidr8_1-_5

NEWSCHOOL_PUBID.01-.05

e27388r3_1-_5

YSCH-27388.01-.05

 

asctr8_1-_5

CV_ASSOC_CREDITS.01-.05

schidr3_1-_7

NEWSCHOOL_PUBID.01-.07

 

bactr8_1-_5

CV_BA_CREDITS.01-.05

asctr3_1-_5

CV_ASSOC_CREDITS.01-.05

 

 

 

bactr3_1-_5

CV_BA_CREDITS.01-.05

 

Current Round Variables

 

e27388r4_1-_4

YSCH-27388.01-.04

 

e273371-e273374

YSCH-27337.01-.04

schidr4_1-_5

NEWSCHOOL_PUBID.01-.05

 

e252971-e252974

YSCH-25297.01-.04

asctr4_1-_4

CV_ASSOC_CREDITS.01-.04

 

e256541-e256544

YSCH-25654.01-.04

bactr4_1-_4

CV_BA_CREDITS.01-.04

 

e162001-e162004

YSCH-16200.01-.04

e27388r5_1-_6

YSCH-27388.01-.06

 

e273881-e273884

YSCH-27388.01-.04

schidr5__1-__6

NEWSCHOOL_PUBID.01-.06

 

e228001-e228004

YSCH-22800.01-.04

asctr5_1-_6

CV_ASSOC_CREDITS.01-.06

 

e230001-e230004

YSCH-23000.01-.04

bactr5_1-_6

CV_BA_CREDITS.01-.06

 

e232001-e232003

YSCH-23200.01-.03

e27388r6_1-_5

YSCH-27388.01-.05

 

e234001-e234003

YSCH-23400.01

schidr6_1-_4

NEWSCHOOL_PUBID.01-.04

 

PUBID

PUBID

asctr6_1-_4

CV_ASSOC_CREDITS.01-.04

 

scode1- scode4

NEWSCHOOL_SCHCODE.01-.04

bactr6_1-_5

CV_BA_CREDITS.01-.05

 

SCHID_1-_4

NEWSCHOOL_PUBID.01-.04

This program calculates fraction of credits earned toward a bachelor's degree (CV_BA_CREDITS) and fraction of credits earned toward a associate's degree (CV_ASSOC_CREDITS) for round 8.


*** arrays for Rounds 1-8;
array asctr2 (*) asctr2_1-asctr2_6; * Fraction of credits earned for Round2;
array bactr2 (*) bactr2_1-bactr2_6; * Fraction of credits earned for Round2;
array asctr3 (*) asctr3_1-asctr3_6; * Fraction of credits earned for Round3;
array bactr3 (*) bactr3_1-bactr3_6; * Fraction of credits earned for Round3;
array asctr4 (*) asctr4_1-asctr4_6; * Fraction of credits earned for Round4;
array bactr4 (*) bactr4_1-bactr4_6; * Fraction of credits earned for Round4;
array asctr5 (*) asctr5_1-asctr5_6; * Fraction of credits earned for Round5;
array bactr5 (*) bactr5_1-bactr5_6; * Fraction of credits earned for Round5;
array asctr6 (*) asctr6_1-asctr6_6; * Fraction of credits earned for Round6;
array bactr6 (*) bactr6_1-bactr6_6; * Fraction of credits earned for Round6;
array asctr7 (*) asctr7_1-asctr7_6; * Fraction of credits earned for Round7;
array bactr7 (*) bactr7_1-bactr7_6; * Fraction of credits earned for Round7;
array asctr8 (*) asctr8_1-asctr8_6; * Fraction of credits earned for Round8;
array bactr8 (*) bactr8_1-bactr8_6; * Fraction of credits earned for Round8;

array e27388r2 (*) e27388r2_1-e27388r2_6; * Total credits needed for graduation, Round2;
array e27388r3 (*) e27388r3_1-e27388r3_6; * Total credits needed for graduation, Round3;
array e27388r4 (*) e27388r4_1-e27388r4_6; * Total credits needed for graduation, Round4;
array e27388r5 (*) e27388r5_1-e27388r5_6; * Total credits needed for graduation, Round5;
array e27388r6 (*) e27388r6_1-e27388r6_6; * Total credits needed for graduation, Round6;
array e27388r7 (*) e27388r7_1-e27388r7_6; * Total credits needed for graduation, Round7;
array e27388r8 (*) e27388r8_1-e27388r8_6; * Total credits needed for graduation, Round8;

array tasctr2 (*) tasctr2_1-tasctr2_6; * Total credits (not fraction) earned with DLI schools, Round2;
array tbactr2 (*) tbactr2_1-tbactr2_6; * Total credits (not fraction) earned with DLI schools, Round2;
array tasctr3 (*) tasctr3_1-tasctr3_6; * Total credits (not fraction) earned with DLI schools, Round3;
array tbactr3 (*) tbactr3_1-tbactr3_6; * Total credits (not fraction) earned with DLI schools, Round3;
array tasctr4 (*) tasctr4_1-tasctr4_6; * Total credits (not fraction) earned with DLI schools, Round4;
array tbactr4 (*) tbactr4_1-tbactr4_6; * Total credits (not fraction) earned with DLI schools, Round4;
array tasctr5 (*) tasctr5_1-tasctr5_6; * Total credits (not fraction) earned with DLI schools, Round5;
array tbactr5 (*) tbactr5_1-tbactr5_6; * Total credits (not fraction) earned with DLI schools, Round5;
array tasctr6 (*) tasctr6_1-tasctr6_6; * Total credits (not fraction) earned with DLI schools, Round6;
array tbactr6 (*) tbactr6_1-tbactr6_6; * Total credits (not fraction) earned with DLI schools, Round6;
array tasctr7 (*) tasctr7_1-tasctr7_6; * Total credits (not fraction) earned with DLI schools, Round7;
array tbactr7 (*) tbactr7_1-tbactr7_6; * Total credits (not fraction) earned with DLI schools, Round7;
array tasctr8 (*) tasctr8_1-tasctr8_6; * Total credits (not fraction) earned with DLI schools, Round8;
array tbactr8 (*) tbactr8_1-tbactr8_6; * Total credits (not fraction) earned with DLI schools, Round8;

array schidr2 (6) schidr2_1-schidr2_6; * School public id for Round 2;
array schidr3 (6) schidr3_1-schidr3_6; * School public id for Round 3;
array schidr4 (6) schidr4_1-schidr4_6; * School public id for Round 4;
array schidr5 (6) schidr5_1-schidr5_6; * School public id for Round 5;
array schidr6 (6) schidr6_1-schidr6_6; * School public id for Round 6;
array schidr7 (6) schidr7_1-schidr7_6; * School public id for Round 7;
array schidr8 (6) schidr8_1-schidr8_6; * School Public id for Round 8;

*** arrays for Round 9;
array e22800 (4) e228001-e228004; * Total no. of credits earned;
array e16200 (4) e162001-e162004; * # Credits Begin College With;
array e23000 (4) e230001-e230004; * (Corrected) Total no. of credits earned;
array e25654 (4) e256541-e256544; * CHK DLI INC COLL CREDIT REF/DK L1 2005;
array e27337 (4) e273371-e273374; * What type of diploma working towards;
array e27388 (4) e273881-e273884; * Total credits required to earn the degree;
array e23200 (4) e232001-e232004; * 1(0): R needs more (does not need any more) credits to graduate;
array e23400 (4) e234001-e234004; * Total no. credits still needed to graduate (asked if e23200=1);
array e25297 (4) e252971-e252974; * CAPI chk: Is this a DLI school?;
array SCHID (4) SCHID_1-SCHID_4; * School public id for Round 7;
array scode (4) scode1-scode4; * School code - type of school or college;
array tcred (4) tcred1-tcred4; * Total credits (not fraction) earned;
array tbac (4) tbac1-tbac4; * Total credits (not fraction) earned towards BA degree;
array tasc (4) tasc1-tasc4; * Total credits (not fraction) earned towards assoc degree;
array noterm (4) noterm1-noterm4; * Attended but did not complete any term;
array tncred (4) tncred1-tncred4; * Sum of transfer, test and H.S. credits;
array flag (4) flag1-flag4; * When inconsistency in credits reported;
array crcred (4) crcred1-crcred4; * C.V. computed using current credits, case 1;
array incred (4) incred1-incred4; * C.V. computed using incoming credits, case 2;
array dlcred (4) dlcred1-dlcred4; * C.V. computed using DLI credits, case 3;
array errci (4) errci1-errci4; * Whether both crcred and incred are 1;
array errcd (4) errcd1-errcd4; * Whether both crcred and dlcred are 1;
array errdi (4) errdi1-errdi4; * Whether both dlcred and incred are 1;
array ovr (4) ovr1-ovr4; * Fraction of AA/BA Credits earned are greater than 100;
array same (4) same1-same4; * Identify the round R last attended current college.;
array dgchk (4) dgchk1-dgchk4; * Checks if school code showed R was in college but degree working
towards was skipped and R had already received GED or HS Diploma.;
array dtprb (4) dtprb1-dtprb4; * Checks if R reports needs more credits but when asked how many, reports ZERO;
array dliprb (4) dliprb1-dliprb4; * If CAPI chk shows this is not a DLI school but it actually is.;
array ngrd (4) ngrd1-ngrd4; * Checks if computed fraction of credits needed to graduate=100 despiteYSCH-23200=0.;
array miss (4) miss1-miss4; * Checks if created variables CVs are missing although R reports attending a college;
array nfrct (4) nfrct1-nfrct4; * CVs>100 recalculated using (total credits+credits remaining in the denominator);
array olfrct (4) olfrct1-olfrct4; * DLI CVs used if CVs this round>100 and no new term is completed.;
array nofrct (4) nofrct1-nofrct4; * Fraction of credits to graduate is missing when CV>100 and cannot be recomputed;
array s (8,6) schidr1_1-schidr1_6 schidr2_1-schidr2_6 schidr3_1-schidr3_6 schidr4_1-schidr4_6
schidr5_1-schidr5_6 schidr6_1-schidr6_6 schidr7_1-schidr7_6 schidr8_1-schidr8_6;
array a (8,6) asctr1_1-asctr1_6 asctr2_1-asctr2_6 asctr3_1-asctr3_6 asctr4_1-asctr4_6
asctr5_1-asctr5_6 asctr6_1-asctr6_6 asctr7_1-asctr7_6 asctr8_1-asctr8_6;
array b (8,6) bactr1_1-bactr1_6 bactr2_1-bactr2_6 bactr3_1-bactr3_6 bactr4_1-bactr4_6
bactr5_1-bactr5_6 bactr6_1-bactr6_6 bactr7_1-bactr7_6 bactr8_1-bactr8_6;
array e (8,6) e27337r2_1-e27337r2_6 e27337r2_1-e27337r2_6 e27337r3_1-e27337r3_6 e27337r4_1-e27337r4_6
e27337r5_1-e27337r5_6 e27337r6_1-e27337r6_6 e27337r7_1-e27337r7_6 e27337r8_1-e27337r8_6;

* Identifying the college that R reported attending in this round is the same one that R attended in some earlier round;

******************* ATTENTION-Definition is given later*****************;
array r88m (6,4) r88m11-r88m14 r88m21-r88m24 r88m31-r88m34 r88m41-r88m44 r88m51-r88m54 r88m61-r88m64;
array r78m (6,4) r78m11-r78m14 r78m21-r78m24 r78m31-r78m34 r78m41-r78m44 r78m51-r78m54 r78m61-r78m64;
array r68m (6,4) r68m11-r68m14 r68m21-r68m24 r68m31-r68m34 r68m41-r68m44 r68m51-r68m54 r68m61-r68m64;
array r58m (6,4) r58m11-r58m14 r58m21-r58m24 r58m31-r58m34 r58m41-r58m44 r58m51-r58m54 r58m61-r58m64;
array r48m (6,4) r48m11-r48m14 r48m21-r48m24 r48m31-r48m34 r48m41-r48m44 r48m51-r48m54 r58m61-r58m64;
array r38m (6,4) r38m11-r38m14 r38m21-r38m24 r38m31-r38m34 r38m41-r38m44 r38m51-r38m54 r38m61-r38m64;
array r28m (6,4) r28m11-r28m14 r28m21-r28m24 r28m31-r28m34 r28m41-r28m44 r28m51-r28m54 r28m61-r28m64;
***************************************************;

array asfrac (4) asfrac1-asfrac4; * Created variable: fraction credits earned for associate credits;
array bafrac (4) bafrac1-bafrac4; * Created variable: fraction credits earned for bachelor credits;

** If a R completed at least one term, CAPI verifies the total credits for each school at YSCH-22800.
Due to a design err, the check question YSCH-22800 does not include Round 2 college credits even
when the SCHID's from both rounds match. However, if a R sees this incorrect count and tells us it is
correct, we will use it. Rs who have yet to complete a term at a given school will not be asked
YSCH-22800. The only credits possible for these people are incoming credits at YSCH-26521, or the DLI
Round created variable for a matching school.;

/******************************************************************************************************
There are 3 ways to compute credits in this program, which are all mutually exclusive:
Case 1: If the R completed any terms, we use YSCH-22800 or YSCH-23000.
Case 2: If the R has not completed any terms and reported a new school, then we use the incoming
credits (26932 OR 26945). For school #1 use YSCH-16200.
Case 3: If the R has not completed any terms and reported a dli school, then we use the total credit
from the dli round (through the SCHID match variable described below).
*******************************************************************************************************/

** Check for people who attended college but were skipped out of YSCH-22800 and YSCH-23000 (because of
no completed terms).;
do i=1 to 4;
if e27337(i) in (1,3) and e22800(i)=-4 and e23000(i)=-4 then noterm(i)=1;
end;

** For Rs who did not complete any terms, the only data available is the incoming credits count (CASE 2)
and the created variable from their DLI round (that is CASE 3). These two pieces of data are exclusive.;
if schidr2_1~=-5 then DLI=2;
if schidr3_1~=-5 then DLI=3;
if schidr4_1~=-5 then DLI=4;
if schidr5_1~=-5 then DLI=5;
if schidr6_1~=-5 then DLI=6;
if schidr7_1~=-5 then DLI=7;
if schidr8_1~=-5 then DLI=8;

do i=1 to 4;
if noterm(i)=1 then do;
if (bactr8(i)>0 or asctr8(i)>0) & DLI=8 then back8=1;
if (bactr7(i)>0 or asctr7(i)>0) & DLI=7 then back7=1;
if (bactr6(i)>0 or asctr6(i)>0) & DLI=6 then back6=1;
if (bactr5(i)>0 or asctr5(i)>0) & DLI=5 then back5=1;
if (bactr4(i)>0 or asctr4(i)>0) & DLI=4 then back4=1;
if (bactr3(i)>0 or asctr3(i)>0) & DLI=3 then back3=1;
if (bactr2(i)>0 or asctr2(i)>0) & DLI=2 then back2=1;
end;
end;

** Check for cases where R says No to "Does this mean you need no more credits to get the degree you're
working toward?" but report ZERO credits for the follow-up question;
do i=1 to 4;
if e23200(i)=0 & e23400(i)=0 then do;
dtprb(i)=1;
dataprb=1;
end;
end;

*** Case 1;
do i=1 to 4;
if e22800(i)>-4 then do;
tcred(i)=e22800(i);
crcred(i)=1;
end;
if e23000(i)>-4 then do;
tcred(i)=e23000(i);
crcred(i)=1;
end;
end;

*** Case 3: The last data source for credits are from previous rounds. Begin by matching current Round
colleges to DLI colleges using the schools' SCHID. Note that this is only used when there are no
completed terms in the current Round (and thus no answer to YSCH-22800) and this school is a dli school;

* Define r57m13 as the dummy variable that equals one when the 1st college on the Round5 school roster
and 3rd college on the Round7 roster have the same SCHID. Define r47m14 as the dummy variable that
equals one when the 1st college on the Round4 school roster and the 4th college on the Round7 roster
have the same SCHID. The "57" match variables require that R missed the Round 6 interview. Any college
from Round1 is represented in the "first" position in the Round 2 created variables i.e. ASFRAC1
(Round 2) is a school from Round 1.;

** If CAPI chk shows this is not a DLI school but it actually is.;
do i=1 to 4;
do j=1 to 6;
if e25297(i)=0 & SCHID(i)>=0 then do;
if SCHID(i)=schidr8(j) & DLI=8 then dliprb(i)=1;
if SCHID(i)=schidr7(j) & DLI=7 then dliprb(i)=1;
if SCHID(i)=schidr6(j) & DLI=6 then dliprb(i)=1;
if SCHID(i)=schidr5(j) & DLI=5 then dliprb(i)=1;
if SCHID(i)=schidr4(j) & DLI=4 then dliprb(i)=1;
if SCHID(i)=schidr3(j) & DLI=3 then dliprb(i)=1;
if SCHID(i)=schidr2(j) & DLI=2 then dliprb(i)=1;
end;
end;
end;

** If any SCHID from the 1st position in Round 2/3/4/5/6/7 matches with any SCHID in Round8;
do i=1 to 6;
do j=1 to 4;
if schidr8(i)=SCHID(j) & DLI=8 & SCHID(j)>0 then do;
r88m(i,j)=1;
same(j)=8;
end;
if schidr7(i)=SCHID(j) & DLI=7 & SCHID(j)>0 then do;
r78m(i,j)=1;
same(j)=7;
end;
if schidr6(i)=SCHID(j) & DLI=6 & SCHID(j)>0 then do;
r68m(i,j)=1;
same(j)=6;
end;
if schidr5(i)=SCHID(j) & DLI=5 & SCHID(j)>0 then do;
r58m(i,j)=1;
same(j)=5;
end;
if schidr4(i)=SCHID(j) & DLI=4 & SCHID(j)>0 then do;
r48m(i,j)=1;
same(j)=4;
end;
if schidr3(i)=SCHID(j) & DLI=3 & SCHID(j)>0 then do;
r38m(i,j)=1;
same(j)=3;
end;
if schidr2(i)=SCHID(j) & DLI=2 & SCHID(j)>0 then do;
r28m(i,j)=1;
same(j)=2;
end;
end;
end;

** We will accept dli credits without a matching degree working towards an answer from current and dli
round. For example, if a R reports working toward a associate's in his/her dli round and then reports
working toward a bachelor's in the current round, we will still use the total dli credits in the
current round created variable, as long as the SCHID's match (i.e., it is the same school).;

** Calculating the total credits have earned towards BA/Assoc degrees for previous rounds, that is
tasctr2/3/4/5/6/7 and tbactr2/3/4/5/6/7;
do i=1 to 6;
if asctr2(i)>=0 then tasctr2(i)=round((asctr2(i)*e27388r2(i)/100),1);
if asctr3(i)>=0 then tasctr3(i)=round((asctr3(i)*e27388r3(i)/100),1);
if asctr4(i)>=0 then tasctr4(i)=round((asctr4(i)*e27388r4(i)/100),1);
if asctr5(i)>=0 then tasctr5(i)=round((asctr5(i)*e27388r5(i)/100),1);
if asctr6(i)>=0 then tasctr6(i)=round((asctr6(i)*e27388r6(i)/100),1);
if asctr7(i)>=0 then tasctr7(i)=round((asctr7(i)*e27388r7(i)/100),1);
if asctr8(i)>=0 then tasctr8(i)=round((asctr8(i)*e27388r8(i)/100),1);

if bactr2(i)>=0 then tbactr2(i)=round((bactr2(i)*e27388r2(i)/100),1);
if bactr3(i)>=0 then tbactr3(i)=round((bactr3(i)*e27388r3(i)/100),1);
if bactr4(i)>=0 then tbactr4(i)=round((bactr4(i)*e27388r4(i)/100),1);
if bactr5(i)>=0 then tbactr5(i)=round((bactr5(i)*e27388r5(i)/100),1);
if bactr6(i)>=0 then tbactr6(i)=round((bactr6(i)*e27388r6(i)/100),1);
if bactr7(i)>=0 then tbactr7(i)=round((bactr7(i)*e27388r7(i)/100),1);
if bactr8(i)>=0 then tbactr8(i)=round((bactr8(i)*e27388r8(i)/100),1);

if asctr2(i)<0 then tasctr2(i)=asctr2(i);
if asctr3(i)<0 then tasctr3(i)=asctr3(i);
if asctr4(i)<0 then tasctr4(i)=asctr4(i);
if asctr5(i)<0 then tasctr5(i)=asctr5(i);
if asctr6(i)<0 then tasctr6(i)=asctr6(i);
if asctr7(i)<0 then tasctr7(i)=asctr7(i);
if asctr8(i)<0 then tasctr8(i)=asctr8(i);

if bactr2(i)<0 then tbactr2(i)=bactr2(i);
if bactr3(i)<0 then tbactr3(i)=bactr3(i);
if bactr4(i)<0 then tbactr4(i)=bactr4(i);
if bactr5(i)<0 then tbactr5(i)=bactr5(i);
if bactr6(i)<0 then tbactr6(i)=bactr6(i);
if bactr7(i)<0 then tbactr7(i)=bactr7(i);
if bactr8(i)<0 then tbactr8(i)=bactr8(i);
end;

do i=1 to 6;
do j=1 to 4;
if tasctr2(i)=>0 & r28m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tasctr2(i); dlcred(j)=1; end;
if tbactr2(i)=>0 & r28m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tbactr2(i); dlcred(j)=1; end;
if tasctr3(i)=>0 & r38m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tasctr3(i); dlcred(j)=1; end;
if tbactr3(i)=>0 & r38m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tbactr3(i); dlcred(j)=1; end;
if tasctr4(i)=>0 & r48m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tasctr4(i); dlcred(j)=1; end;
if tbactr4(i)=>0 & r48m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tbactr4(i); dlcred(j)=1; end;
if tasctr5(i)=>0 & r58m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tasctr5(i); dlcred(j)=1; end;
if tbactr5(i)=>0 & r58m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tbactr5(i); dlcred(j)=1; end;
if tasctr6(i)=>0 & r68m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tasctr6(i); dlcred(j)=1; end;
if tbactr6(i)=>0 & r68m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tbactr6(i); dlcred(j)=1; end;
if tasctr7(i)=>0 & r78m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tasctr7(i); dlcred(j)=1; end;
if tbactr7(i)=>0 & r78m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tbactr7(i); dlcred(j)=1; end;
if tasctr8(i)=>0 & r88m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tasctr8(i); dlcred(j)=1; end;
if tbactr8(i)=>0 & r88m(i,j)=1 & e22800(j)=-4 & e16200(j)=-4 then do; tcred(j)=tbactr8(i); dlcred(j)=1; end;
end;
end;

*** Case 2: The following are people who reported a new school and have no completed terms (and thus no
answer to YSCH-22800). Use incoming credits.;

** YSCH-16200 only applies to school #1. It is an incoming credits question, and is only used when
YSCH-22800 and YSCH-23000 are valid skipped. This is asked only if a DLI college is reported and the
incoming credits reported is refused/dont know.;
do i=1 to 4;
if e16200(i)>-4 & e22800(i)=-4 & e23000(i)=-4 then do;
tcred(i)=e16200(i);
incred1=2;
end;
end;

** Check that the incoming credits (YSCH-162001) for school #1 equals the computed credits from that
school. If R answers that the incoming credits are wrong then YSCH-16200.01 is asked. Thus
YSCH-16200.01 is given precedence.;
do i=1 to 4;
if dlcred(i)=1 & incred(i)=2 & tcred(i)~=e16200(i) & e25654(i)~=1 then incredprb=1;
if dlcred(i)=1 & incred(i)=2 & tcred1~=e16200(i) & e25654(i)=1 then incredprb=0;
end;

** Check to make sure the three methods of collecting credits information do not overlap.;
do i=1 to 4;
if crcred(i)=1 & incred(i)=1 then errci(i)=1;
if crcred(i)=1 & dlcred(i)=1 then errcd(i)=1;
if incred(i)=1 & dlcred(i)=1 then errdi(i)=1;
if incred(i)=2 & dlcred(i)=1 then errdi(i)=2;
end;

***** Initialize both created variables.;
do i=1 to 4;
asfrac(i)=0;
bafrac(i)=0;
end;

do i=1 to 4;
if e27337(i)=-5 then asfrac(i)=-5;
if e27337(i)=-5 then bafrac(i)=-5;
end;

do i=1 to 4;
* Associates Degree;
if e27337(i)=1 & tcred(i)=>0 then tasc(i)=tcred(i);
if (-4<e27388(i)<0|-4<tcred(i)<0) & e27337(i)=1 then asfrac(i)=-3;
if tasc(i)=>0 & e27388(i)>0 then asfrac(i)=(tasc(i)/e27388(i))*100;
asfrac(i)=round(asfrac(i),1);
if e23200(i)=1 & e27337(i)=1 then asfrac(i)=100; * Rs who say they have graduated;

* Bachelors Degree;
if e27337(i) in (3,10) & tcred(i)=>0 then tbac(i)=tcred(i);
if (-4<e27388(i)<0|-4<tcred(i)<0) & e27337(i)in (3,10) then bafrac(i)=-3;
if tbac(i)=>0 & e27388(i)>0 then bafrac(i)=(tbac(i)/e27388(i))*100;
bafrac(i)=round(bafrac(i),1);
if e23200(i)=1 & e27337(i)in (3,10) then bafrac(i)=100; * Rs who say they have graduated;
end;

*** Checking for fraction of credits earned>100 or fraction of credits earned=100 but reports did not graduate.;
** Checking for the cases that credit fraction greater than 100;
do i=1 to 4;
if asfrac(i)>100 then ovr(i)=1;
if bafrac(i)>100 then ovr(i)=2;
if ovr(i)>=1 then over100=1;
end;

** Checking for the cases that get 100 or more percent credits but say need more credits to graduate;
do i=1 to 4;
if asfrac(i)>=100 & e23200(i)=0 then ngrd(i)=1;
if bafrac(i)>=100 & e23200(i)=0 then ngrd(i)=2;
if ngrd(i)>=1 then notgrad=1;
end;

** Checking missing asfrac and bafrac;
do i=1 to 4;
if e27337(i)=1 and asfrac(i)=. then miss(i)=1;
if e27337(i) in (1,10) and bafrac(i)=. then miss(i)=2;
end;

** Asfrac or bafrac>=100, which means that they gained more credits than the credits required for the
degree (e27388), which means that they claimed that they still need more credits for the
degree (e23200=0) we would handle these observations as below:
(a) if e23200=0 and e23400>0, we add up e23400 and (tasc/tbac) the credits the Rs have earned as the
total credits required for the degree, and use it without e27388 to calculate the cv.
(33 school 1 R7)
(b) if e23200=0 and e23400<=0, e23450 equals -4. we would give -3 to CV.
(c) For observations that asfrac or bafrac>=100 and they haven't completed any term so we don't have
information about e23200 and e23400, use the same fraction as at last round. However if this is
a new college then we cannot use this method.
(d) if there are cases with CV>100 even after all these re-computations (a-c) then we give them -3
unless they made some corrections to the credits required to graduate (e23400).;

/****************************** NOTE: YSCH-23360.X ****************************************
** The wording of YSCH-23360 had some problem. It will NOT corrected until round 10. So, **
** this round and round 9 will not use this question. But from round 10, we can use this **
** question and should do the changes on code accordingly then. **
*******************************************************************************************/

** Case (a);
do i=1 to 4;
if ngrd(i)=1 & e23400(i)>0 then do;
asfrac(i)=round(100*tasc(i)/(tasc(i)+e23400(i)),1);
nfrct(i)=1;
end;
if ngrd(i)=2 & e23400(i)>0 then do;
bafrac(i)=round(100*tbac(i)/(tbac(i)+e23400(i)),1);
nfrct(i)=2;
end;
end;

** Case (b);
do i=1 to 4;
if ngrd(i)=1 & e23400(i)<=0 then do;
asfrac(i)=-3;
nofrct(i)=1;
end;
if ngrd(i)=2 & e23400(i)<=0 then do;
bafrac(i)=-3;
nofrct(i)=2;
end;
end;

** Case (c);
do i=1 to 4;
if asfrac(i)>100 & e23200(i)=-4 & e23400(i)=-4 then do;
olfrct(i)=1;
do j=1 to 8;
if DLI=j then do;
do k=1 to 6;
if SCHID(i)=s(j,k) & e(j,k)=1 & dlcred(i)=1 then asfrac(i)=a(j,k);
if SCHID(i)=s(j,k) & e(j,k)~=1 & dlcred(i)=1 then asfrac(i)=0;
end;
end;
end;
end;
if bafrac(i)>100 & e23200(i)=-4 & e23400(i)=-4 then do;
olfrct(i)=2;
do j=1 to 8;
if DLI=j then do;
do k=1 to 6;
if SCHID(i)=s(j,k) & e(j,k)=3 & dlcred(i)=1 then bafrac(i)=b(j,k);
if SCHID(i)=s(j,k) & e(j,k)~=3 & dlcred(i)=1 then bafrac(i)=0;
end;
end;
end;
end;
end;

*** Case (d);
do i=1 to 4;
if asfrac(i)>100 & e23400(i)>=0 then do;
asfrac(i)=round(100*tasc(i)/(tasc(i)+e23400(i)),1);
nfrct(i)=1;
end;
if asfrac(i)>100 & e23400(i)<0 then do;
asfrac(i)=-3;
nofrct(i)=1;
end;
if bafrac(i)>100 & e23400(i)>=0 then do;
bafrac(i)=round(100*tbac(i)/(tbac(i)+e23400(i)),1);
nfrct(i)=2;
end;
if bafrac(i)>100 & e23400(i)<0 then do;
bafrac(i)=-3;
nofrct(i)=2;
end;
end;

*** If R not working towards Associates or Bachelor's degree.;
do i=1 to 4;
if e27337(i)=-4 then do;
asfrac(i)=-4;
bafrac(i)=-4;
end;
if e27337(i)in (1, 2, 4, 5, 6, 7, 8, 9, 999) then bafrac(i)=-4;
if e27337(i)in (2,3,4,5,6,7,8,9,10,999) then asfrac(i)=-4;
if e27337(i) in (-1,-2,-3) then asfrac(i)=-3;
if e27337(i) in (-1,-2,-3) then bafrac(i)=-3;
end;

/*********** Sometimes the degree working towards question is skipped (this is fine if these Rs have
no HSD or GED). They may be enrolled in college to get some extra college credits but are currently
enrolled in high school and should have CV=-4. But some are legitimately working towards an
AA/BA degree but since they got skipped out of the degree working towards question they got skipped
out of credits earned question as well. We code them as -3.;
********************************************************************/
do i=1 to 4;
if e27337(i)=-4 & scode(i) in (4,5) & (hsd=1|ged=1) then do;
dgchk(i)=1;
bafrac(i)=-3;
asfrac(i)=-3;
end;
end;

/* There are five hand-edits for the Rd 9 Credits Variable. The first hand edit are cases
that are not enrolled in college in Rd 9. There was a glitch in the survey in rd 9 such that
dli schools remained on the roster even if a stop date was provided in rd 8. Cases that were truly not enrolled
and only appeared to be because of this glitch are assigned a -4.
The second hand-edit is for cases that report a B.A. or A.A., through other information than credits in Rd 9.
These cases are given values of 100%.
The third hand edit is for cases that were erroneously skipped from incoming credit variables because of the problem
with schools remaining on the roster from the previous round. These cases are assigned a value of -3 because we do
not have complete credit information for them.
The fourth hand-edit involves cases that answer yes to ysch-23300 and are thus
automatically assigned 100% for their credits. There are some cases however, that although they report that they
need no more credits to graduate also indicate that they have no degree and there is no evidence other than ysch-23300
that they have in fact finished their course work, thus, we are assigning these cases a -3.
The fifth hand-edit involves cases that are working towards a B.A. but leave school with an A.A. These cases are assigned
a -4 value for ba_credits and 100% for assoc_credits.*\

/* HAND-EDIT #1 44 cases*/
if pubid in (1592 1170 6741 4855 3317 8561 8354 4818 6331 7311
4960 404 6507 4265 37 1897 1436 7839 2069 4838
3638 7292 922 721 128 4547 6334 7198) then bafrac1=-4;
if pubid in (3153 7874 454 7874 4759 4803 6667 8114 1094 6789
1753 5763 2344 5421 548 4677) then asfrac1=-4;
if pubid in (8438) then bafrac2=-4;

/*Hand-Edit #2 95 cases*/
if pubid in (181 300 422 458 632 649 680 742  747 949 988 1075 1082 1145 1163 1235 1313 1412 1642 1906 2075 2078 2133 2203 2307 2328 2394 2398 3074 3076 3166 3435 3489 3595 3659 4006 4027 4124 4207 4340 4406 4583 4629 4789 4814 4815 4895 4942 5057 5355 5446 5738 5790 5838 5861 5879 5949 6142 6249 6565 7190 7534 7687 7825  7933 8119 8225 8451 8467)
then bafrac1=100;
if pubid in (1098 1515 1802 1807 1970 1971 2435 2701 2828 3015 3680
4248 4539 5510 5946 6602 6730 6770 7123 7637 7856 8795) then asfrac1=100;
if pubid in (309) then bafrac2=100;

/*Hand-Edit #3 40 cases*/
if pubid in (1414 2055 5077 7099 2332 8393) then bafrac1=-3;
if pubid in (11 8355 581 6425 6425 8661 34) then asfrac1=-3;
if pubid in (87 206 509 667 1358 1753 1893 3091 4702 5388 5762 5861 6088
6125 6239 6277 6370 6648 7059 8646 8874) then bafrac2=-3;
if pubid in (183 2748 3603 5097 6164 6173 7799) then asfrac2=-3;

/*Hand-Edit #4 74 cases */
if pubid in (182 311 359 685 749 932 1013 1019 1370 1672 2575 2585 2944 3051 3398
4032 4062 4788 5136 5142 5151 5312 5779 5779 5924 6156 6671 6798 6826 7193 7237
7275 7553 7871 8104 8391 8444 8501 8814 8902) then bafrac1=-3;
if pubid in (65 472 626 851 851 1022 1032 1379 1774 1882 2170 3027 3107 3469 3690 5237
5620 5745 5867 5881 5936 5943 7111 7199 7202 7519 7547 7560) then asfrac1=-3;
if pubid in (6362 7123 7874) then  bafrac2=-3;
if pubid in (996 1035 6635 6739) then asfrac2=-3;
if pubid= 7226 then bafrac3=-3;

/*Hand-Edit #5 8 cases*/
if pubid in (8893 7576 6874 4804 5725 647) then do;
bafrac1=-4;
asfrac1=100;
end;
if pubid in (1902 6859) then asfrac1=-4;

ENDSAS;
 

Return to top


Collapsed Schooling Variables


Collapsed Grades Repeated/Skipped, Highest Grade/Degree Completed, Number of Schools Attended, and Date Received Diploma/Degree

Variables Created: 

Variables Used

Name in Program

Question Name in Data

e311 array YSCH-5000 (round 1)
YSCH-3112 (rounds 2-9)
hsr array CV_HS_DIPLOMA
gdr array CV_GED
aar array CV_AA_DEGREE
bar array CV_BA_DEGREE
mar array CV_MA_DEGREE
num array CV_SCH_ATTEND_EVER
grs array CV_HGC_EVER_EDT
dgs array CV_HIGHEST_DEGREE_EVER_EDT
rep array CV_GRADES_REPEAT_EVER
skp array CV_GRADE_SKIPPED_EVER

Codes for Created Variable

This program collapses information collected across rounds into a single set of variables.  The codes for each collapsed variable are the same as the codes for the corresponding variables from the individual survey rounds. Note that these variables are created for all respondents, regardless of whether they were interviewed in round 9.


** Creating the collapsed variables;
array e311 (*) e5000r1 e3112r2-e3112r9;
array dgs (*) degsurvr1-degsurvr9;
array grs (*) grsurvr1-grsurvr9;
array num (*) numr1-numr9;
array rep (*) numrepr1-numrepr9;
array skp (*) numskipr1-numskipr9;
array gdr (*) gdr1-gdr9;
array hsr (*) hsr1-hsr9;
array aar (*) aar1-aar9;
array bar (*) bar1-bar9;
array mar (*) mar1-mar9;

cvc_DEGSURV=-4;
cvc_GRSURV=-4;
cvc_NUMS=-4;
cvc_NUMREP=-4;
cvc_NUMSKIP=-4;
cvc_CDTGD=-4;
cvc_CDTHS=-4;
cvc_CDTAA=-4;
cvc_CDTBA=-4;
cvc_CDTMA=-4;
do j=1 to 9;
if e311(j)~=-5 then do;
cvc_DEGSURV=dgs(j);
cvc_GRSURV=grs(j);
cvc_NUMS=num(j);
cvc_NUMREP=rep(j);
cvc_NUMSKIP=skp(j);
cvc_CDTGD=gdr(j);
cvc_CDTHS=hsr(j);
cvc_CDTAA=aar(j);
cvc_CDTBA=bar(j);
cvc_CDTMA=mar(j);
end;
end;

endsas;


Collapsed Date Left High School and Highest High School Grade Completed

Variables Created: 

Variables Used

Name in Program Question Name in Data   Name in Program Question Name in Data

comp_mor2-comp_mor9

internal variable indicating month completed grade in round   hsr1-hsr9 CV_HS_DIPLOMA (all rounds)

comp_yrr2-comp_yrr9

internal variable indicating year completed grade in round   e3500r1 YSCH-3500 (round 1)

grsurvFr1-grsurvFr8

internal variable indicating highest high school grade completed   e2857r2-e2857r9 YSCH-2857 (rounds 2-9)

maxgrader2-maxgrader9

internal variable indicating the maximum grade attended   RNIr1-RNIr9 RNI (all rounds)

stopmr1_1-stopmr9_31

NEWSCHOOL_STOP[Y].XX~M (all rounds)   doicmr1-doicmr9 CV_INTERVIEW_CMONTH (all rounds)

stopyr1_1-stopyr9_31

NEWSCHOOL_STOP[Y].XX~Y (all rounds)   encatr1-encatr9 CV_ENROLLSTAT (all rounds)

scoder1_1-scoder9_4

NEWSCHOOL_SCHCODE.XX (all rounds)   e5000r1 YSCH-5000 (round 1)

HEs

internal variable indicating a handedit: highest grade ever   e3112r2-e3112r9 YSCH-3112 (rounds 2-9)

HEj

internal variable indicating a handedit: highest grade as of June   e3878r2-e3878r9 YSCH-3878 (rounds 2-9)

HEe

internal variable indicating a handedit: enrollment status   graugr1-graugr9 CV_HGC_xxyy (all rounds)

HEh

internal variable indicating a handedit: high school diploma   grsurvr1-grsurvr9 CV_HGC_EDT (all rounds)

HEg

internal variable indicating a handedit: GED   dobm, doby KEY!BDATE~M, ~Y (round 1)

gdr1-gdr9

CV_GED (all rounds)      

This program creates two variables: the date the respondent left high school and the highest grade completed at that point. It is created for all respondents who have a highest grade completed greater than 12, who have received a high school diploma or GED, who are at least age 21, or who are in college. Note that this variable is created for all respondents, regardless of whether they were interviewed in round 9.


/******************************************************************************************************
Computing the Final Highest Grade Completed. The conditions to be met to compute this are as follows:
HGC>=12 or received H.S. Diploma or age at last interview is greater than 20 or R is in college.;

Three possible definitions:
(1) The date R received H.S. Diploma - DATE_RECD_HSD
(2) The date R completed grade HGC - DATE_COMP_HGC
(3) The date R stopped attending school - DATE_SCH_STOP
if R is deceased or R was in college when last interviewed or R's age was greater than 21 when last interviewed.

DATE_LEFT_SCH is computed as follows:
Use (1), if (1) is not available then use (2), and if (2) is also not available then use (3)

DATE_LEFT_SCH could not be computed by this rule for SEVEN respondents:
pubid in (381 1437 4225 5200 6725 7652 8778); These cases are coded as a -3.

******************************************************************************************************/
** Defining all arrays used in the program;
array HEs (*) HE2_GRS HE3_GRS HE4_GRS HE5_GRS HE6_GRS HE7_GRS HE8_GRS HE9_GRS;
array HEj (*) HE2_GRJ HE3_GRJ HE4_GRJ HE5_GRJ HE6_GRJ HE7_GRJ HE8_GRJ HE9_GRJ;
array HEe (*) HE2_EN HE3_EN HE4_EN HE5_EN HE6_EN HE7_EN HE8_EN HE9_EN;
array HEh (*) HE2_HS HE3_HS HE4_HS HE5_HS HE6_HS HE7_HS HE8_HS HE9_HS;
array HEg (*) HE2_GD HE3_GD HE4_GD HE5_GD HE6_GD HE7_GD HE8_GD HE9_GD;
array e285 (*) e3500r1 e2857r2-e2857r9;
array e387 (*) e3878r1-e3878r9;
array RNI (*) RNIr1-RNIr9;
array grs (*) grsurvr1-grsurvr9;
array gra (*) graugr1-graugr9;
array grsF (*) grsurvFr1-grsurvFr9;
array dli (*) dli1-dli9;
array hsr (*) hsr1-hsr9;
array gdr (*) gdr1-gdr9;
array doic (*) doicmr1-doicmr9;
array enc (*) encatr1-encatr9;
array mxg (*) maxgrader1-maxgrader9;
array cmo (*) comp_mor1-comp_mor9;
array cyr (*) comp_yrr1-comp_yrr9;
array grcmdt (*) gr12_comp_dt_r1-gr12_comp_dt_r9;
array stopm (*) stopmr1_1 stopmr2_11-stopmr2_16 stopmr2_21-stopmr2_24 stopmr2_31 stopmr3_11-stopmr3_17 stopmr3_21-stopmr3_24 stopmr3_31-stopmr3_32
stopmr4_11-stopmr4_15 stopmr4_21-stopmr4_23 stopmr5_11-stopmr5_16 stopmr5_21-stopmr5_23 stopmr5_31 stopmr6_11-stopmr6_14 stopmr6_21-stopmr6_23
stopmr7_11-stopmr7_15 stopmr7_21-stopmr7_22 stopmr7_31 stopmr8_11-stopmr8_15 stopmr8_21-stopmr8_23 stopmr8_31-stopmr8_32
stopmr9_11-stopmr9_14 stopmr9_21 stopmr9_31;

array stopy (*) stopyr1_1 stopyr2_11-stopyr2_16 stopyr2_21-stopyr2_24 stopyr2_31 stopyr3_11-stopyr3_17 stopyr3_21-stopyr3_24 stopyr3_31-stopyr3_32
stopyr4_11-stopyr4_15 stopyr4_21-stopyr4_23 stopyr5_11-stopyr5_16 stopyr5_21-stopyr5_23 stopyr5_31 stopyr6_11-stopyr6_14 stopyr6_21-stopyr6_23
stopyr7_11-stopyr7_15 stopyr7_21-stopyr7_22 stopyr7_31 stopyr8_11-stopyr8_15 stopyr8_21-stopyr8_23 stopyr8_31-stopyr8_32
stopyr9_11-stopyr9_14 stopyr9_21 stopyr9_31;

array scode (*) scoder1_1 scoder2_1-scoder2_6 scoder2_1-scoder2_4 scoder2_1 scoder3_1-scoder3_7 scoder3_1-scoder3_4 scoder3_1-scoder3_2
scoder4_1-scoder4_5 scoder4_1-scoder4_3 scoder5_1-scoder5_6 scoder5_1-scoder5_3 scoder5_1 scoder6_1-scoder6_4 scoder6_1-scoder6_3
scoder7_1-scoder7_5 scoder7_1-scoder7_2 scoder7_1 scoder8_1-scoder8_5 scoder8_1-scoder8_3 scoder8_1-scoder8_2 scoder9_1-scoder9_4 scoder9_1 scoder9_1;

** Identifying handedits;
hand1=0; hand2=0; hand3=0;
do i=1 to dim(HEs);
if HEs(i)=1|HEj(i)=1 then do;
hand1=i+1;
i=dim(HEs);
end;
end;
do i=1 to dim(HEs);
if HEs(i)=2|HEj(i)=2 then do;
hand2=i+1;
i=dim(HEs);
end;
end;
do i=2 to dim(HEs);
if HEe(i)>0|HEh(i)>0|HEg(i)>0 then do;
hand3=i+1;
i=dim(HEs);
end;
end;

** Computing date of birth in continuous month scheme (cmb).;
cmb=((doby-1980)*12)+dobm;

** Computing DLI round;
do i=1 to dim(grs);
if grs(i)~=-5 then do;
do j=1 to i-1;
if grs(j)~=-5 then dli(i)=j;
end;
ageLI=round((doic(i)-cmb)/12);
encatLI=enc(i);
DLI_RND=i;
if hsr(i)>-4 then HSD=1;
if hsr(i)=-4 then HSD=0;
if gdr(i)>-4 then GED=1;
if gdr(i)>-4 then GED=1;
grsurv_LI=grs(i);
e3878LI=e387(i);
end;
if RNI(i)=98 then DECEASED=1;
end;

** Computing nosch;
do i=1 to dim(grs);
if nosch<1 & e387(i) in (0,-5) or (e387(i)=1 & enc(i) in (4,5,6,7,9,10,11)) then nosch=i;
if e387(i)=1 & enc(i) in (1,2,3,8) then nosch=0;
end;

** Imputing e2857;
do i=2 to dim(grs);
if 0<e285(i)<=6 & grs(i)>12 then do;
e285(i)=12+e285(i);
imp1=i;
end;
end;

** Computing Highest Grade Completed: - HGCa, HGC.;
HGC=grsurvFr9;
do i=1 to dim(grs);
if grs(i)~=-5 then HGCa=gra(i);
end;

flag1=-3;
if HSD=1 then flag1=1;
if HSD=0 & HGC=12 then flag1=2;
if HSD=0 & (HGC<12|HGC=95) & ageLI>0 then flag1=round(ageLI);

do i=1 to dim(grs);
if grsF(i)=HGC then do;
HGC_rnd=i;
i=dim(grs);
end;
end;

** Computing Date Left High School (1) - DATE_RECD_HSD.;
DATE_RECD_HSD=-4;
do i=1 to dim(grs);
if hsr(i)~=-5 then DATE_RECD_HSD=hsr(i);
end;

** Computing Date Left High School (3) - DATE_COMP_HGC.;
do i=1 to dim(grs);
if mxg(i)=12 then do;
if cmo(i)>0 & cyr(i)>0 then grcmdt(i)=((cyr(i)-1980)*12)+cmo(i);
if cmo(i)<0|cyr(i)<0 then do;
grcmdt(i)=-3;
end;
end;
end;

ct=0;
DATE_COMP_HGC=-4;
do i=1 to dim(grs);
if grcmdt(i)>-4 then ct=ct+1;
if grcmdt(i)>0 & DATE_COMP_HGC<0 & grs(i)>=12 then do;
DATE_COMP_HGC=grcmdt(i);
end;
if grcmdt(i)>0 & DATE_COMP_HGC>0 & grs(i)>=12 then do;
DATE_COMP_HGC=min(grcmdt(i),DATE_COMP_HGC);
end;
if -4<grcmdt(i)<=0 & DATE_COMP_HGC=-4 & grs(i)>=12 then do;
DATE_COMP_HGC=grcmdt(i);
end;
end;

if DATE_COMP_HGC=-4 then do;
do i=1 to dim(grs);
if grcmdt(i)>-4 & grs(i)<12 then never_comp_12=1;
end;
end;

** Computing Date Left High School (2) - DATE_SCH_STOP.;
DATE_SCH_STOP=-4;
do i=1 to dim(scode);
if scode(i) in (1,2,3) then do;
if stopy(i)>0 & stopm(i)>0 & DATE_SCH_STOP<(((stopy(i)-1980)*12)+stopm(i))
then DATE_SCH_STOP=(((stopy(i)-1980)*12)+stopm(i));
if (stopy(i)<=0|stopm(i)<=0) & DATE_SCH_STOP<-3
then DATE_SCH_STOP=-3;
ATT_SCH=1;
end;
end;
** Dropped out of school before R1 and died by R2 interview;
if pubid= 4225 then do;
DATE_SCH_STOP=-3;
end;

** Date graduated from High School from Transcripts - DATE_LEFT_TRS;
if LEFT_REASON=1 then do;
if LEFT_DATEM>0 & LEFT_DATEY>0 then DATE_LEFT_TRS=((LEFT_DATEY-1980)*12)+LEFT_DATEM;
if LEFT_DATEM<0 & LEFT_DATEY>0 then DATE_LEFT_TRS=((LEFT_DATEY-1980)*12)+6;
if LEFT_DATEY<0 then DATE_LEFT_TRS=-3;
end;

** Computing Date Left High School - DATE_LEFT_SCH
using DATE_RECD_HSD, DATE_SCH_STOP and DATE_COMP_HGC.;

DATE_LEFT_SCH=-4;
if DATE_RECD_HSD>-4 & DATE_LEFT_SCH<0 then do;
DATE_LEFT_SCH=DATE_RECD_HSD;
LOC_DT=1;
end;
if DATE_COMP_HGC>-4 & DATE_LEFT_SCH<0 then do;
DATE_LEFT_SCH=DATE_COMP_HGC;
LOC_DT=2;
end;
if DATE_SCH_STOP>-4 & DATE_LEFT_SCH<0 & DECEASED=1 then do;
DATE_LEFT_SCH=DATE_SCH_STOP;
LOC_DT=3.1;
end;
if DATE_SCH_STOP>-4 & DATE_LEFT_SCH<0 & encatLI in (4,5,6,7,9,10,11) then do;
DATE_LEFT_SCH=DATE_SCH_STOP;
LOC_DT=3.2;
end;
if DATE_SCH_STOP>-4 & DATE_LEFT_SCH<0 & ageLI>20 then do;
DATE_LEFT_SCH=DATE_SCH_STOP;
LOC_DT=3.3;
end;
if DATE_LEFT_TRS>-4 & DATE_LEFT_SCH<0 then do;
DATE_LEFT_SCH=DATE_LEFT_TRS;
LOC_DT=4.1;
end;
if DATE_LEFT_TRS>-4 & DATE_LEFT_SCH>-4 & LOC_DT in (3.1,3.2,3.3) & DATE_LEFT_TRS<DATE_LEFT_SCH then do;
DATE_LEFT_SCH=DATE_LEFT_TRS;
LOC_DT=4.2;
end;
if DATE_SCH_STOP>-4 & DATE_LEFT_SCH=-4 & ageLI>17 then LOC_DT_a=1;
if DATE_SCH_STOP>-4 & DATE_LEFT_SCH=-3 & ageLI>17 then LOC_DT_a=2;
if DATE_LEFT_SCH=-4 & GED=1 then LOC_DT_b=1;

age_jan08=round((337-cmb)/12);
endsas;


Collapsed SAT/ACT Scores

Variables Created: 

Variables Used

Name in Program Question Name in Data   Name in Program Question Name in Data   Name in Program Question Name in Data

satact97

YSCH-7700

 

actyes00

YSCH-7800~000002

 

actyesd02

YSCH-9303~000002

satyes97

YSCH-7800_000001

 

satm00

YSCH-8400.01

 

satmd02

YSCH-9307.01

actyes97

YSCH-7800_000002

 

satv00

YSCH-8500.01

 

satvd02

YSCH-9308.01

satm97

YSCH-8400.01

 

actscr00

YSCH-9200

 

actscrd02

YSCH-9311

satv97

YSCH-8500.01

 

satactd00

YSCH-9302

 

satact03

YSCH-7700

actscr97

YSCH-9200.05

 

satyesd00

YSCH-9303~000001

 

satyes03

YSCH-7800~000001

satact98

YSCH-7700

 

actyesd00

YSCH-9303~000002

 

actyes03

YSCH-7800~000002

satyes98

YSCH-7800~000001

 

satmd00

YSCH-9307.01

 

satm03

YSCH-8400.01

actyes98

YSCH-7800~000002

 

satvd00

YSCH-9308.01

 

satv03

YSCH-8500.01

satm98

YSCH-8400.01

 

actscrd00

YSCH-9311

 

actscr03

YSCH-9200

satv98

YSCH-8500.01

 

satact01

YSCH-7700

 

satactd03

YSCH-9302

actscr98

YSCH-9200

 

satyes01

YSCH-7800~000001

 

satyesd03

YSCH-9303~000001

satactd98

YSCH-9302

 

actyes01

YSCH-7800~000002

 

actyesd03

YSCH-9303~000002

satyesd98

YSCH-9303~000001

 

satm01

YSCH-8400.01

 

satmd03

YSCH-9307.01

actyesd98

YSCH-9303~000002

 

satv01

YSCH-8500.01

 

satvd03

YSCH-9308.01

actscrd98

YSCH-9311

 

actscr01

YSCH-9200

 

actscrd03

YSCH-9311

satact99

YSCH-7700

 

satactd01

YSCH-9302

 

satact04

YSCH-7700

satyes99

YSCH-7800~000001

 

satyesd01

YSCH-9303~000001

 

satyes04

YSCH-7800~000001

actyes99

YSCH-7800~000002

 

actyesd01

YSCH-9303~000002

 

actyes04

YSCH-7800~000002

satm99

YSCH-8400.01

 

satmd01

YSCH-9307.01

 

satm04

YSCH-8400

satv99

YSCH-8500.01

 

satvd01

YSCH-9308.01

 

satv04

YSCH-8500

actscr99

YSCH-9200

 

actscrd01

YSCH-9311

 

actscr04

YSCH-9200

satactd99

YSCH-9302

 

satact02

YSCH-7700

 

satactd04

YSCH-9302

satyesd99

YSCH-9303~000001

 

satyes02

YSCH-7800~000001

 

satact05

YSCH-7700

actyesd99

YSCH-9303~000002

 

actyes02

YSCH-7800~000002

 

satyes05

YSCH-7800~000001

satmd99

YSCH-9307.01

 

satm02

YSCH-8400.01

 

actyes05

YSCH-7800~000002

satvd99

YSCH-9308.01

 

satv02

YSCH-8500.01

 

satm05

YSCH-8400

actscrd99

YSCH-9311

 

actscr02

YSCH-9200

 

satv05

YSCH-8500

satact00

YSCH-7700

 

satactd02

YSCH-9302

 

actscr05

YSCH-9200

satyes00

YSCH-7800~000001

 

satyesd02

YSCH-9303~000001

 

pubid

PUBID

Codes for Created Variable

These variables report the highest SAT Math, SAT Verbal, and ACT composite score reported in any round by the respondent. Because they are collapsed variables, they include data for all respondents and not just those interviewed in round 9. A second set of variables gives the round in which the highest score was reported.

SAT scores are coded:   ACT scores are coded:
1  200 - 300   1  0 - 6
2 301 - 400   2 7 - 12
3 401 - 500   3 13 - 18
4 501 - 600   4 19 - 24
5 601 - 700   5 25 - 30
6 701 - 800   6 31 - 36
0 Have not yet received the scores   0 Have not yet received the scores

Note that the ACT scores for 1997 are not included in this variable. In that round, the score was broken out by test section and no aggregate score was reported. In subsequent rounds, only an aggregate score was reported. 


*satact(d)XX=did the r take the sat or the act in XX (1=yes, 0=no) ^(d) denotes same variable since DLI
satyes(d)XX=did the r take the sat in XX (1=yes, 0=no)
actyes(d)XX=did the r take the act in XX (1=yes, 0=no)
satm(d)XX=the highest score received by the r on the math portion of the sat in XX
satv(d)XX=the highest score received by the r on the verbal portion of the sat in XX
actscr(d)XX=the highest score received by the r on the act in XX
yract=the year in which the highest ACT score was reported
yrsatm=the year in which the highest SAT Math score was reported
yrsatv=the year in which the highest SAT Verbal score was reported

The output is
actmax=highest ACT score ever received
satmmax=highest score ever received on the math section of the SAT
satvmax=highest score ever received on the verbal section of the SAT

For this variable, an answer of '0' is coded as a -3.;

* assigning a validscore of 1 if the respondent had taken the act or sat;
if max(satact97, satact98, satact99, satact00, satact01, satact02, satact03, satact04, satact05,
satactd98, satactd99, satactd00, satactd01, satactd02, satactd03, satactd04)>0 then validscore= 1;
if max(satact97, satact98, satact99, satact00, satact01, satact02, satact03, satact04, satact05,
satactd98, satactd99, satactd00, satactd01, satactd02, satactd03, satactd04) le 0 then validscore= 0;

*assigning a null value for actmax if the respondent has never taken the act;
if validscore= 0 or (validscore= 1 and max(actyes97, actyes98, actyes99, actyes00, actyes01, actyes02, actyes03, actyes04, actyes05,
actyesd98, actyesd99, actyesd00, actyesd01, actyesd02, actyesd03)le 0) then
actmax=.;

*assigning a null value if the respondent has never take the sat;
if validscore= 0
or (validscore= 1 and max(satyes97, satyes98, satyes99, satyes00, satyes01, satyes02, satyes03, satyes04, satyes05,
satyesd98, satyesd99, satyesd00, satyesd01, satyesd02, satyesd03)le 0)then
satmmax=.;
satvmax=.;

*gives the max act score if one is reported, -3 for invalid skip, null for valid skip;
if validscore=1 and max(actyes97, actyes98, actyes99, actyes00, actyes01, actyes02, actyes03, actyes04, actyes05,
actyesd98, actyesd99, actyesd00, actyesd01, actyesd02, actyesd03)= 1 then do;
if max(actscr97, actscr98,actscr99, actscr00, actscr01, actscr02, actscr03, actscr04, actscr05,
actscrd98,actscrd99, actscrd00, actscrd01, actscrd02, actscrd03) > 0
then actmax= max(actscr97,actscr98,actscr99, actscr00, actscr01, actscr02, actscr03, actscr04, actscr05,
actscrd98,actscrd99, actscrd00, actscrd01, actscrd02, actscrd03);

else if -3 <= max(actscr97,actscr98,actscr99, actscr00, actscr01, actscr02, actscr03, actscr04, actscr05,
actscrd98,actscrd99, actscrd00, actscrd01, actscrd02, actscrd03) le 0
then actmax=-3;

else if max(actscr97, actscr98,actscr99, actscr00, actscr01, actscr02, actscr03, actscr04, actscr05,
actscrd98,actscrd99, actscrd00, actscrd01, actscrd02, actscrd03)< -3
then actmax=.;
end;

*gives the max sat math score if one is reported, -3 for invalid skip, null for valid skip;
if validscore=1 and max(satyes97, satyes98, satyes99, satyes00, satyes01, satyes02, satyes03, satyes04, satyes05,
satyesd98, satyesd99, satyesd00, satyesd01, satyesd02, satyesd03)=1 then do;
if max(satm97, satm98, satm99, satm00, satm01, satm02, satm03, satm04, satm05,
satmd99, satmd00, satmd01, satmd02, satmd03) > 0
then satmmax=max(satm97, satm98, satm99, satm00, satm01, satm02, satm03, satm04, satm05,
satmd99, satmd00, satmd01, satmd02, satmd03);

else if -3 <= max(satm97, satm98, satm99, satm00, satm01, satm02, satm03, satm04, satm05,
satmd99, satmd00, satmd01, satmd02, satmd03) le 0
then satmmax=-3;

else if max(satm97, satm98, satm99, satm00, satm01, satm02, satm03, satm04, satm05,
satmd99, satmd00, satmd01, satmd02, satmd03) <-3
then satmmax=.;

*gives the max sat verbal score if one is reported, -3 for invalid skip, null for valid skip;
if max(satv97, satv98, satv99, satv00, satv01, satv02, satv03, satv04, satv05,
satvd99, satvd00, satvd01, satvd02, satvd03) > 0
then satvmax=max(satv97, satv98, satv99, satv00, satv01, satv02, satv03, satv04, satv05,
satvd99, satvd00, satvd01, satvd02, satvd03);

else if -3 <= max(satv97, satv98, satv99, satv00, satv01, satv02, satv03, satv04, satv05,
satvd99, satvd00, satvd01, satvd02, satvd03) le 0
then satvmax=-3;

else if max(satv97, satv98, satv99, satv00, satv01, satv02, satv03, satv04, satv05,
satvd99, satvd00, satvd01, satvd02, satvd03) < -3
then satvmax=.;
end;

scr1=actscr97;
scr2=max(actscr98,actscrd98);
scr3=max(actscr99,actscrd99);
scr4=max(actscr00,actscrd00);
scr5=max(actscr01,actscrd01);
scr6=max(actscr02,actscrd02);
scr7=max(actscr03,actscrd03);
scr8=actscr04;
scr9=actscr05;

if actmax>0 and actmax=scr1 then rdact1=1;
if actmax>0 and actmax=scr2 then rdact2=2;
if actmax>0 and actmax=scr3 then rdact3=3;
if actmax>0 and actmax=scr4 then rdact4=4;
if actmax>0 and actmax=scr5 then rdact5=5;
if actmax>0 and actmax=scr6 then rdact6=6;
if actmax>0 and actmax=scr7 then rdact7=7;
if actmax>0 and actmax=scr8 then rdact8=8;
if actmax>0 and actmax=scr9 then rdact9=9;

if actmax>0 then rdact=min(rdact1,rdact2,rdact3,rdact4,rdact5,rdact6,rdact7,rdact8,rdact9);
if actmax=. then rdact=.;

scrm1=satm97;
scrm2=satm98;
scrm3=max(satm99,satmd99);
scrm4=max(satm00,satmd00);
scrm5=max(satm01,satmd01);
scrm6=max(satm02,satmd02);
scrm7=max(satm03,satmd03);
scrm8=satm04;
scrm9=satm05;

if satmmax>0 and satmmax=scrm1 then rdsatm1=1;
if satmmax>0 and satmmax=scrm2 then rdsatm2=2;
if satmmax>0 and satmmax=scrm3 then rdsatm3=3;
if satmmax>0 and satmmax=scrm4 then rdsatm4=4;
if satmmax>0 and satmmax=scrm5 then rdsatm5=5;
if satmmax>0 and satmmax=scrm6 then rdsatm6=6;
if satmmax>0 and satmmax=scrm7 then rdsatm7=7;
if satmmax>0 and satmmax=scrm8 then rdsatm8=8;
if satmmax>0 and satmmax=scrm9 then rdsatm9=9;

if satmmax>0 then rdsatm=min(rdsatm1,rdsatm2,rdsatm3,rdsatm4,rdsatm5,rdsatm6,rdsatm7,rdsatm8,rdsatm9);
if satmmax=. then rdsatm=.;

scrv1=satv97;
scrv2=satv98;
scrv3=max(satv99,satvd99);
scrv4=max(satv00,satvd00);
scrv5=max(satv01,satvd01);
scrv6=max(satv02,satvd02);
scrv7=max(satv03,satvd03);
scrv8=satv04;
scrv9=satv05;

if satvmax>0 and satvmax=scrv1 then rdsatv1=1;
if satvmax>0 and satvmax=scrv2 then rdsatv2=2;
if satvmax>0 and satvmax=scrv3 then rdsatv3=3;
if satvmax>0 and satvmax=scrv4 then rdsatv4=4;
if satvmax>0 and satvmax=scrv5 then rdsatv5=5;
if satvmax>0 and satvmax=scrv6 then rdsatv6=6;
if satvmax>0 and satvmax=scrv7 then rdsatv7=7;
if satvmax>0 and satvmax=scrv8 then rdsatv8=8;
if satvmax>0 and satvmax=scrv9 then rdsatv9=9;

if satvmax>0 then rdsatv=min(rdsatv1,rdsatv2,rdsatv3,rdsatv4,rdsatv5,rdsatv6,rdsatv7,rdsatv8,rdsatv9);
if satvmax=. then rdsatv=.;

*gives the round the invalid skip was reported;
rd9=0;rd8=0;rd7=0;rd6=0;rd5=0;rd4=0;rd3=0;rd2=0;rd1=0;
if actmax=-3 and -3 =< actscr05 =<0 then rd9=9;
if actmax=-3 and -3 =< actscr04 =<0 then rd8=8;
if actmax=-3 and -3 =< actscr03 =<0 then rd7=7;
if actmax=-3 and -3 =< actscrd03 =<0 then rd7=7;
if actmax=-3 and -3 =< actscr02 =<0 then rd6=6;
if actmax=-3 and -3 =< actscrd02 =<0 then rd6=6;
if actmax=-3 and -3 =< actscr01 =<0 then rd5=5;
if actmax=-3 and -3 =< actscrd01 =<0 then rd5=5;
if actmax=-3 and -3 =< actscr00 =<0 then rd4=4;
if actmax=-3 and -3 =< actscrd00 =<0 then rd4=4;
if actmax=-3 and -3 =< actscr99 =<0 then rd3=3;
if actmax=-3 and -3 =< actscrd99 =<0 then rd3=3;
if actmax=-3 and -3 =< actscr98 =<0 then rd2=2;
if actmax=-3 and -3 =< actscrd98 =<0 then rd2=2;
if actmax=-3 and -3 =< actscr97 =<0 then rd1=1;

if actmax=-3 then rdact=max(rd1,rd2,rd3,rd4,rd5,rd6,rd7,rd8,rd9);

rdm9=0;rdm8=0;rdm7=0;rdm6=0;rdm5=0;rdm4=0;rdm3=0;rdm2=0;rdm1=0;
if satmmax=-3 and -3 =< satm05 =<0 then rdm9=9;
if satmmax=-3 and -3 =< satm04 =<0 then rdm8=8;
if satmmax=-3 and -3 =< satm03 =<0 then rdm7=7;
if satmmax=-3 and -3 =< satmd03 =<0 then rdm7=7;
if satmmax=-3 and -3 =< satm02 =<0 then rdm6=6;
if satmmax=-3 and -3 =< satmd02 =<0 then rdm6=6;
if satmmax=-3 and -3 =< satm01 =<0 then rdm5=5;
if satmmax=-3 and -3 =< satmd01 =<0 then rdm5=5;
if satmmax=-3 and -3 =< satm00 =<0 then rdm4=4;
if satmmax=-3 and -3 =< satmd00 =<0 then rdm4=4;
if satmmax=-3 and -3 =< satm99 =<0 then rdm3=3;
if satmmax=-3 and -3 =< satmd99 =<0 then rdm3=3;
if satmmax=-3 and -3 =< satm98 =<0 then rdm2=2;
if satmmax=-3 and -3 =< satm97 =<0 then rdm1=1;
if satmmax=-3 then rdsatm=max(rdm1,rdm2,rdm3,rdm4,rdm5,rdm6,rdm7,rdm8,rdm9);

rdv9=0;rdv8=0;rdv7=0;rdv6=0;rdv5=0;rdv4=0;rdv3=0;rdv2=0;rdv1=0;
if satvmax=-3 and -3 =< satv05 =<0 then rdv9=9;
if satvmax=-3 and -3 =< satv04 =<0 then rdv8=8;
if satvmax=-3 and -3 =< satv03 =<0 then rdv7=7;
if satvmax=-3 and -3 =< satvd03 =<0 then rdv7=7;
if satvmax=-3 and -3 =< satv02 =<0 then rdv6=6;
if satvmax=-3 and -3 =< satvd02 =<0 then rdv6=6;
if satvmax=-3 and -3 =< satv01 =<0 then rdv5=5;
if satvmax=-3 and -3 =< satvd01 =<0 then rdv5=5;
if satvmax=-3 and -3 =< satv00 =<0 then rdv4=4;
if satvmax=-3 and -3 =< satvd00 =<0 then rdv4=4;
if satvmax=-3 and -3 =< satv99 =<0 then rdv3=3;
if satvmax=-3 and -3 =< satvd99 =<0 then rdv3=3;
if satvmax=-3 and -3 =< satv98 =<0 then rdv2=2;
if satvmax=-3 and -3 =< satv97 =<0 then rdv1=1;
if satvmax=-3 then rdsatv=max(rdv1,rdv2,rdv3,rdv4,rdv5,rdv6,rdv7,rdv8,rdv9);

endsas;
 

Return to top


Training:  Receipt of Certificate or Vocational License

Variables Created:

Variables Used

Name in Program

Question Name in Data

t640m1-t640m2 YTRN640.01-.02
t640y1-t640y2 YTRN640.01-.02
t690001-t690009 YTRN6900.01-.09
t700001-t700009 YTRN7000.01-.09
t1500m1-t1500m9 YTRN1500.00-.06
t1500y1-t1500y9 YTRN1500.00-.06
TRNCYR CV_TRN_CERT
TRNCMTH CV_TRN_CERT_DATE~Y
TRNCERT CV_TRN_CERT_DATE~M
PUBID PUBID_2003

Codes for Created Variable

Ever Received Vocational/Completion Certificate or State License (TRNCERT)

0  Condition Does Not Apply (no)--R took a training, but didn't earn cert.
1  Condition Applies (yes)

This program creates a variable that reports whether the respondent has ever received a certificate or license other than a GED through a training program.  If so, a pair of variables provide the month and year that the most recent certificate or license was obtained. 


/*Initialize variables*/
TRNCERT=.; /*Ever received vocational/completion certificate or state license*/
TRNCMTH=.; /*Month of most recent certificate/license--based on date of completion
of most recent cert/lic granting training program*/
TRNCYR=.; /*Year of most recent certificate/license--based on date of completion
of most recent cert/lic granting training program*/
reccert=0; /* a counting variable for use in programming to check do loops*/

/*Defining arrays*/
array t69000{9} t69001 - t69009;
array t70000{9} t70001 - t70009;
array t1500m{9} t1500m1 - t1500m9;
array t1500y{9} t1500y1 - t1500y9;
array t640m{9} t640m1 - t640m9;
array t640y{9} t640y1 - t640y9;
array trncrt{9} trncrt97 - trncrt99 trncrt2000- trncrt2005;
array trncmo{9} trncmo97 - trncmo99 trncmo2000 - trncmo2005;
array trncy{9} trncy97 - trncy99 trncy2000-trncy2005;

do i=1 to 9;
if reccert=0 and t69000{i}=1 and 1<=t70000{i}<=3 and t640y{i}>-4 then do;
TRNCERT=1;
TRNCYR=t640y{i};
TRNCMTH=t640m{i};
reccert=1;
end;
if reccert=0 and t69000{i}=1 and 1<=t70000{i}<=3 and t1500y{i}>-4 then do;
TRNCERT=1;
TRNCYR=t1500y{i};
TRNCMTH=t1500m{i};
reccert=1;
end;

if reccert>=1 and t69000{i}=1 and 1<=t70000{i}<=3 and t1500y{i}=TRNCYR and t1500m{i}>TRNCMTH then do;
TRNCMTH=t1500m{i};
reccert=reccert+1;
end;
if reccert>=1 and t69000{i}=1 and 1<=t70000{i}<=3 and t640y{i}=TRNCYR and t640m{i}>TRNCMTH then do;
TRNCMTH=t640m{i};
reccert=reccert+1;
end;

if reccert>=1 and t69000{i}=1 and 1<=t70000{i}<=3 and t1500y{i}>TRNCYR then do;
TRNCYR=t1500y{i};
TRNCMTH=t1500m{i};
reccert=reccert+1;
end;
if reccert>=1 and t69000{i}=1 and 1<=t70000{i}<=3 and t640y{i}>TRNCYR then do;
TRNCYR=t640y{i};
TRNCMTH=t640m{i};
reccert=reccert+1;
end;

if TRNCERT^=1 then do;
if t69000{i}=0 then TRNCERT=0;
if t69000{i}=1 and t70000{i}>3 then TRNCERT=0;
if t69000{i}=1 and t70000{i}<1 then TRNCERT=0;
end;
end;

/*code non-interviews*/
if t69001=-5 then do;
TRNCERT=-5;
TRNCYR=-5;
TRNCMTH=-5;
end;

/*This part compares values for current round to created vars for previous round(s) to obtain the most recent date of cert/lic receipt*/
do i=1 to 9;
if trncert=. and trncrt{i}=1 then do;
TRNCERT=TRNCRT{i};
TRNCYR=TRNCY{i};
TRNCMTH=TRNCMO{i};
end;

if trncert=0 and trncrt{i}=1 then do;
TRNCERT=TRNCRT{i};
TRNCYR=TRNCY{i};
TRNCMTH=TRNCMO{i};
end;

if trncert=-3 and trncrt{i}=1 then do;
TRNCERT=TRNCRT{i};
TRNCYR=TRNCY{i};
TRNCMTH=TRNCMO{i};
end;

*if previous report was an invalid skip and there has never been a valid cert reported, this carries that value forward.;
if trncert=. and trncrt{i} in (-1, -2, -3) then do;
TRNCERT=TRNCRT{i};
TRNCYR=TRNCY{i};
TRNCMTH=TRNCMO{i};
end;

if TRNCERT=1 and TRNCRT{i}=1 and TRNCY{i}>TRNCYR then do;
TRNCYR=TRNCY{i};
TRNCMTH=TRNCMO{i};
end;

if TRNCERT=1 and TRNCRT{i}=1 and TRNCY{i}=TRNCYR and TRNCMO{i}>TRNCMTH then do;
TRNCMTH=TRNCMO{i};
end;

if TRNCERT=. and TRNCRT{i}=0 then do;
TRNCERT=TRNCRT{i};
TRNCYR=TRNCY{i};
TRNCMTH=TRNCMO{i};
end;
end;

if TRNCYR=-2 or TRNCYR=-1 then TRNCYR=-3;
if TRNCMTH=-2 or TRNCMTH=-1 then TRNCMTH=-3;
if TRNCERT=. and t69001=-4 then TRNCERT=-4;
if TRNCERT=. and t69001=-5 then TRNCERT=-5;
if TRNCERT=. and t69001=-2 then TRNCERT=-3;
if TRNCERT=. and t69001=-1 then TRNCERT=-3;
if TRNCERT=. and t69001=-3 then TRNCERT=-3;
if TRNCERT=. then TRNCERT=0;
/*if R received training cert but there is no date, then date variables = invalid skip*/
if TRNCERT=1 and TRNCMTH<1 then TRNCMTH=-3;
if TRNCERT=1 and TRNCYR<1 then TRNCYR=-3;
/*if R took training but did not receive training cert then the date variables=valid skip */
if TRNCERT=0 then TRNCMTH=-4;
if TRNCERT=0 then TRNCYR=-4;
if TRNCERT=-3 then TRNCMTH=-3;
if TRNCERT=-3 then TRNCYR=-3;
if TRNCERT=-4 then TRNCMTH=-4;
if TRNCERT=-4 then TRNCYR=-4;
if TRNCERT=-5 then TRNCMTH=-5;
if TRNCERT=-5 then TRNCYR=-5;

if int_y=-5 and int_m=-5 then do;
TRNCERT=-5;
TRNCYR=-5;
TRNCMTH=-5;
end;

*hand edit added rd9 to account for -3's from previous rounds that were wrongly coded as a -4;
if pubid= 3755 or pubid= 8713 then do;
TRNCERT=-3;
TRNCMTH=-3;
TRNCYR=-3;
end;

endsas;


Return to top Return to Table of Contents