/* ----------------------------- exemplar5 preprocessing ex5_prep.sas Gillian Raab Novembr 04 proc contents data=exemp5.ex5 position; run; */ data exemp5.ex5 ; set aa.ywom (rename=(q1=sex q3=marstat q4a=nadults q4b=nchild q5=empl q11a=genhelf q6=qual)); keep weight gweight sinc sacc age q85a q85b living empl qual genhelf ; weight=avweight; if q84=2 then do; q85a=1; q85b=1; end; if nchild=. then nchild=0; if sex=2 and age<30;* four men; if nadults=0 or nadults=. then nadults=1; if nadults=1 and marstat in (1,3) then nadults=2; fam=put(nadults,2.0)||put(nchild,2.0); if nadults=1 and (nchild=. or nchild=0) then living=1; else if nadults=1 and nchild>=1 then living=2 ; else if nadults=2 and marstat in (1,3) and (nchild=0 or nchild=.) then living=3 ; else if nadults=2 and marstat in (1,3) and nchild>0 then living=4 ; else living=5 ;*fam;*put(min(nadults+nchild,4),20.0); attrib living label='composition of household'; attrib sinc label='data zone income deprivation score'; attrib sacc label='data zone access deprivation score'; attrib gweight label='weight adding to population totals'; attrib weight label='weight'; format q85a q85b genhelf empl qual 2.0; format sinc best8.; run; proc contents data=exemp5.ex5 position; run;