/* ReadLabelMath2.sas */ title 'Gender, Ethnicity and Math performance'; proc format; value ynfmt 0 = 'No' 1 = 'Yes'; value crsfmt 1 = 'Catch-up ' 2 = 'Mainstream' 3 = 'Elite ' 4 = 'No Resp '; value nfmt 1 = 'Chinese' 2 = 'Japanese' 3 = 'Korean' 4 = 'Vietnamese' 5 = 'Other Asian' 6 = 'Eastern European' 7 = 'Hispanic' 8 = 'English-speaking' 9 = 'French' 10 = 'Italian' 11 = 'Greek' 12 = 'Germanic' 13 = 'Other European' 14 = 'Middle-Eastern' 15 = 'Pakistani' 16 = 'East Indian' 17 = 'Sub-Saharan' 18 = 'OTHER or DK'; value ncfmt 1 = 'Asian' 2 = 'Eastern European' 3 = 'European not Eastern' 4 = 'Middle-Eastern and Pakistani' 5 = 'East Indian' 6 = 'Other and DK' ; data math; infile '/home/u1407221/441s24/data/math.data.txt'; input id course precalc calc gpa calculus english mark lang $ sex $ nation1 nation2 sample; /* Computed Variables: totscore, outcome passed, grade, hsgpa, hscalc, hsengl, havecalc, tongue, course2, ethnic */ totscore = precalc+calc; if 50 <= mark <= 100 then outcome = 'Passed '; else if 0 <= mark <= 49 then outcome = 'Failed '; else outcome = 'Disappeared'; if (50<=mark<=100) then passed=1; else passed=0; /* Some missing final marks were zero, and 998=SDF and 999=WDR */ if mark=0 then grade=.; else if mark > 100 then grade=.; else grade=mark; /* Missing HS marks were zeros */ if 65 le gpa le 100 then hsgpa = gpa; /* Else missing is automatic */ if 1 le calculus le 100 then hscalc = calculus; if calculus = . then havecalc = 0; else havecalc=1; /* Just guessing */ if 1 le english le 100 then hsengl = english; /* There were just a few French speakers */ if lang='French' then tongue='Other '; else tongue=lang; course2 = course; if course2 = 4 then course2 = .; /********* Nationality According to the 2 raters **********/ if 1 <= nation1 <= 5 then rater1 = 1; else if nation1 = 6 then rater1 = 2; else if 7 <= nation1 <= 13 then rater1 = 3; else if 14 <= nation1 <= 15 then rater1 = 4; else if nation1 = 16 then rater1 = 5; else rater1 = 6; if 1 <= nation2 <= 5 then rater2 = 1; else if nation2 = 6 then rater2 = 2; else if 7 <= nation2 <= 13 then rater2 = 3; else if 14 <= nation2 <= 15 then rater2 = 4; else if nation2 = 16 then rater2 = 5; else rater2 = 6; /* Rater 1 knows Middle Eastern names -- otherwise believe Rater 2 */ if rater1=4 then ethnic=rater1; else ethnic=rater2; /* Dummy variables for ethnic background */ if ethnic=. then e1=.; else if ethnic=1 then e1=1; else e1=0; if ethnic=. then e2=.; else if ethnic=2 then e2=1; else e2=0; if ethnic=. then e3=.; else if ethnic=3 then e3=1; else e3=0; if ethnic=. then e4=.; else if ethnic=4 then e4=1; else e4=0; if ethnic=. then e5=.; else if ethnic=5 then e5=1; else e5=0; if ethnic=. then e6=.; else if ethnic=6 then e6=1; else e6=0; label e1 = 'Asian' e2 = 'East Eur' e3 = 'Other Eur' e4 = 'Mid. East & Pak' e5 = 'East Ind' e6 = 'Other/DK'; /* More dummy variables */ if sex = 'Female' then gender=1; else if sex = 'Male' then gender=0; if tongue = 'English' then mtongue=1; else if tongue='Other' then mtongue=0; label mtongue = 'English vs. Other'; /* Only use 2 of these if the model has an intercept! */ if course2=. then c1=.; else if course2=1 then c1=1; else c1=0; if course2=. then c2=.; else if course2=2 then c2=1; else c2=0; if course2=. then c3=.; else if course2=3 then c3=1; else c3=0; label c1 = 'Catch-up' c2 = 'Mainstream' c3 = 'Elite'; /********************************************************************/ label precalc = 'Number precalculus correct' calc = 'Number calculus correct' totscore = 'Total # right on diagnostic test' outcome = 'Passed, Failed or Disappeared' passed = 'Passed the course' grade = 'Final mark' hsgpa = 'High School GPA' hscalc = 'HS Calculus' hsengl = 'HS English' havecalc = 'Took High School Calculus' lang = 'Mother Tongue' rater1 = 'Nationality of name acc to rater1' rater2 = 'Nationality of name acc to rater2' tongue = 'Mother Tongue (Eng or Other)' ethnic = 'Judged Nationality of name' ; format course course2 crsfmt.; format passed havecalc ynfmt.; format nation1 nation2 nfmt.; format rater1 rater2 ethnic ncfmt.; data replic; set math; if sample = 2; /* Otherwise delete */ data explore; set math; if sample = 1; /* Otherwise delete */ keep id sex tongue rater1 rater2 ethnic hsgpa hscalc hsengl havecalc course2 precalc calc totscore grade passed outcome e1-e6 gender mtongue c1-c3; /* Dummy vars */ /* Not reordered */ /* Now explore is the most recently created data set, so it's the default. */ run; /*********************************************************************/