***************************************************************** * PROGRAM: SCP.SAS * * PROGRAMMER: Floyd Hummel => Hyoshin Kim => Anne Corrigan * * => Patrick Malone => John Klaric * * DATE: 9/17/95, modified: 3/22/96 (FH) * * 1/7/2004 (JK) * * 4/20/04 rename scored variables to comply * * with FT standards * PURPOSE: Creates scored dataset (aggregated across * * cohorts and sites) from Social Competence- * * Parent scales. * * INPUT P&YR.D_SC.SAS7BDAT * * OUTPUT SCP&YR.SAS7BDAT, * *****************************************************************; ** Enter year of data collection -- possible years: 1,2,3**; %let yr = 3 ; libname SASIN "N:\Datasets\Parent\socialcompetenceparent\U"; libname SASOUT "N:\Datasets\Parent\socialcompetenceparent\S"; *************** DO NOT MODIFY BELOW THIS LINE ******************************; ** The macro "LINMEAN" creates subscales that are means of individual ** ** scale items. The score mean ** ** is defined as missing if half or more of the scale items are ** ** missing. When less than half of the scale items are missing, the scale ** ** mean is the mean of the nonmissing items. LINMEAN specifies the input ** ** items as a string of variable names ("var_list"), and specifies the ** ** label and name of the output variable as "var_name" and "var_labl" ** ** respectively. "LINSUM" performs the same operations on item data when ** ** less than half of the scale items are missing, but essentially ** ** calculates the sum of nonmissing scale items. **; %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; %macro linsum; 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(*))*dim(sumvars); proc sort; by site tcid; run; %mend linsum; *****************************************************************************; data SASOUT.SCP&yr.; set SASIN.p&yr.d_sc; run; /* Specify definitions for SCALE VARIABLES below: ** */ %let INDATA = SASOUT.SCP&yr.; ************************************************************; %let var_name = SCP&yr.COM; %let var_labl = %str(Prosocial/Comm. Skills - SCP - Y&yr.) ; %let var_list = %str(P&yr.DSC4 P&yr.DSC7 P&yr.DSC9 P&yr.DSC10-P&yr.DSC12) ; %linmean; ************************************************************; %let var_name = SCP&yr.EMO ; %let var_labl = %str(Emotional Reg. Skills - SCP - Y&yr.) ; %let var_list = %str(P&yr.DSC1-P&yr.DSC3 P&yr.DSC5 P&yr.DSC6 P&yr.DSC8) ; %linmean ; ************************************************************; %let var_name = SCP&yr.TOT ; %let var_labl = %str(Item Total - SCP - Y&yr.) ; %let var_list = %str(P&yr.DSC1-P&yr.DSC12) ; %linmean ; ************************************************************; proc means;run;