Appendix: SAS Program %let yr = xx; libname sasin "I:\datacenter\SASDATA\Datasets\Child\fearofcrime\U"; libname sasout "I:\datacenter\SASDATA\Datasets\Child\fearofcrime\S"; %macro linmean; data &INDATA; set &INDATA; label &var_name = "&var_labl"; array sumvars {*} &var_list; if n(of sumvars(*))>=.5*dim(sumvars) then &var_name=mean(of sumvars(*)); proc sort; by site tcid; run; %mend linmean; data one; set sasin.c&yr.au; array one (*) c&yr.au5-c&yr.au12; array two (*) c&yr.au5s c&yr.au6s c&yr.au7s c&yr.au8s c&yr.au9s c&yr.au10s c&yr.au11s c&yr.au12s; do i=1 to dim(two); two(i)=one(i); end ; drop i; run; proc standard mean=0 std=1 data=one out=two; var c&yr.au5s c&yr.au6s c&yr.au7s c&yr.au8s c&yr.au9s c&yr.au10s c&yr.au11s c&yr.au12s; run; data sasout.FCQ&yr.; set two; label C&yr.AU5s="Std-How afraid are you of being attacked or robbed-at home in your house or apartment?" C&yr.AU6s="Std-How afraid are you of being attacked or robbed-on the streets of your neighborhood during the day?" C&yr.AU7s="Std-How afraid are you of being attacked or robbed-out alone at night in your neighborhood?" C&yr.AU8s="Std-How afraid are you of being attacked or robbed-out with other people at night in your neighborhood?" C&yr.AU9s="Std-Has fear of crime caused-you to limit the places you will go by yourself?" C&yr.AU10s="Std-Has fear of crime caused-you to get a gun or weapon for self-protection?" C&yr.AU11s="Std-Has fear of crime caused-your family to install a home security system or car alarm?" C&yr.AU12s="Std-Has fear of crime caused-your family to move to a different place to live?" ;run; %let INDATA = sasout.FCQ&yr.; %let var_name = FCQ&yr.TOT; %let var_labl = %str(Fear of Crime-FCQ-Year &yr.) ; %let var_list = %str(c&yr.au5s c&yr.au6s c&yr.au7s c&yr.au8s c&yr.au9s c&yr.au10s c&yr.au11s c&yr.au12s); %linmean; proc sort;by cohort site tcid;run;