/* describemath0.sas */ title 'Gender, Ethnicity and Math performance'; title2 'Basic descriptive statistics on the combined sample'; proc format; value ynfmt 0 = 'No' 1 = 'Yes'; value crsfmt 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, passed, grade, hsgpa, hscalc, hsengl, tongue, class, ethnic */ totscore = precalc+calc; 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 1 le english le 100 then hsengl = english; /* There were just a few French speakers */ if lang='French' then tongue='Other '; else tongue=lang; label tongue = 'Mother Tongue (Eng or Other)'; class = course; if class = 4 then class = .; /********* 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; /********************************************************************/ label precalc = 'Number precalculus correct' calc = 'Number calculus correct' totscore = 'Total # right on diagnostic test' passed = 'Passed the course' grade = 'Final mark' hsgpa = 'High School GPA' hscalc = 'HS Calculus' hsengl = 'HS English' 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 crsfmt.; format passed ynfmt.; format nation1 nation2 nfmt.; format rater1 rater2 ethnic ncfmt.; /*********************************************************************/ /* Check created variables */ /* Do this for transformed quantitative variables - Lots of output proc print data=math; var mark grade; */ /* Check created variables proc freq data=math; tables lang*tongue / norow nocol nopercent missing; tables course*class / norow nocol nopercent missing; tables nation1*rater1 / norow nocol nopercent missing; tables nation2*rater2 / norow nocol nopercent missing; tables (rater1 rater2) * ethnic / norow nocol nopercent missing; */ /* Could use "by" , like this to get separate results for each sample. proc sort data=math; by sample; proc means data=math; title3 'Quantitative Variables'; by sample; var precalc calc totscore hsgpa hscalc hsengl grade; */ proc means data=math; title3 'Quantitative Variables'; class sample; var precalc calc totscore hsgpa hscalc hsengl grade; proc freq data=math; title3 'Categorical variables'; tables sample * (course sex ethnic tongue passed) / norow nocol nopercent missing; run; quit;