/***************** senic97c.sps ********************/ set width=80. title 'Senic example #3: fixed format, computes, var & value labels'. data list file='senic.dat' /1 id 1-5 stay 7-11 age 13-16 infrisk 18-20 culratio 22-25 xratio 27-31 nbeds 33-35 medschl 37 region 39 census 41-43 nurses 45-47 service 49-52. /* additional lines of data for each case would be read with /2, /3 etc. missing values stay,age culratio,xratio (9999) infrisk(999) nbeds to census, service (9) nurses (0,.999). variable labels id 'hospital identification number' stay 'av length of hospital stay, in days' age 'average patient age' infrisk 'prob of acquiring infection in hospital' culratio '# cultures performed / # no hosp acq infect' xratio '# x-rays / # no signs of pneumonia' nbeds 'average # beds during study period' medschl 'medical school affiliation' region 'region of country (usa)' census 'aver # patients in hospital per day' nurses 'aver # nurses during study period' service '% of 35 potential facilities & services'. value labels medschl 1 'yes' 2 'no' / region 1 'northeast' 2 'north central' 3 'south' 4 'west' /. comment ***** recodes, computes & ifs ***** recode age (lowest thru 53=1)(53.1 thru highest=2) into agecat1. variable labels agecat1 'av patient age category'. value labels agecat1 1 '53 & under' 2 'over 53'/. recode age (lowest thru 53=1)(53.1 thru highest=2)(9999=9) into agecat2. missing values agecat2 (9). recode age (9999=9)(lowest thru 53=1)(53.1 thru highest=2) into agecat3. missing values agecat3 (9). recode age (lowest thru 53=1)(53.1 thru highest=2) (missing=sysmis) into agecat4. recode age (missing=sysmis)(lowest thru 53=1)(53.1 thru highest=2) into agecat5. comment compute ad hoc index of hospital quality compute quality=(2*service+nurses+nbeds+10*culratio +10*xratio-2*stay)/medschl. if (region eq 3) quality=quality-100. variable labels quality 'jerry''s bogus hospital quality index'. recode region (1,2=1) (3,4=2). value labels region 1 'north' 2 'south & west'/. frequencies variables=agecat1 to agecat5,region. subtitle locate hospitals with av stay greater than 15 days if (stay gt 15) longstay=id. frequencies variables=longstay.