/********************* senic1.sas ***************************/ title 'Open SENIC Data'; title2 'Basic Descriptive Statistics'; proc format; /* Value labels used in data step below */ value yesnofmt 1 = 'Yes' 0 = 'No' ; value regfmt 1 = 'Northeast' 2 = 'North Central' 3 = 'South' 4 = 'West' ; data senic; infile '/home/u1407221/441s24/SAS02/openSENIC2.data.txt' firstobs=2; /* Skip the first line that R uses */ input id region mdschl $ census nbeds nurses lngstay age xratio culratio infpercent; /* Fix up problems */ if mdschl = '?' then mdschl = ' '; /* Blank = missing for character vars */ if age = 999 then age = .; if infpercent = 999 then infpercent = .; /***** Recodes, computes & ifs *****/ if 053 then agecat='Over 53'; label agecat = 'Average patient age'; quality=(2*nurses+nbeds+10*culratio +10*xratio-2*lngstay); if mdschl eq 'No' then quality=quality/2; if (region eq 3) then quality=quality-100; label quality = 'Jerry''s bogus hospital quality index'; proc freq; title3 'Frequency distributions of categorical variables'; tables region mdschl agecat; proc means; title3 'Table of means and standard deviations'; var census nbeds nurses lngstay age xratio culratio infpercent quality; /* How did SAS handle the missing value for age? */ proc freq; title3 'Check missing value for age'; tables age * agecat / norow nocol nopercent missing; run;