/* Social Competence Scale - Teacher Version */ /* Scoring Program */ /* Year 3, Cohort 1 */ /* Adapted by Anne Corrigan */ /* Uses V8 of SAS */ /* Jan. 8, 2003 */ /* AC - Note Dec. 29, 2002: Dataset names are changed to be more mnemonic. Pathnames are changed to SAS dataset directory on local drive. Correct version of allkey is merged in. SASIN and SCORED data library names are not used.*/ /*********************************************************************************/ ************************************************************ * PROGRAM: SCT3ST1.SAS * * PROGRAMMER: Floyd Hummel -> Anne Corrigan * * DATE: 2/26/98 - revision of T1B1SCR.SAS * * The revision changes variable names to * * the new scheme, adds dataset label 01/08/03 - revision by AC * * * * PURPOSE: Create dataset with SC-Teacher scales. * * * * INPUT: Not used: DTyBc, NTyBc, PTyBc, STyBc y-year, c=coh. * * Grade=Year-3 * * OUTPUT: t&yr.bscsubscores * ************************************************************; OPTIONS PAGESIZE = 71 REPLACE LABEL NUMBER SOURCE LINESIZE=71; /* Specify cohort number - not used %let coh = 1 ; */ ** Enter year of data collection **; %let yr = 3 ; libname data "D:\sasdata\T&yr.B1SCDataAllFixed"; *************** DO NOT MODIFY BELOW THIS LINE ******************************; options nostimer ; /* suppress info in log file about execution times */ ** The macro, "linsum" creates derived variables which are sums of input ** ** scale items. In the case of missing input items, the output variable ** ** is defined to be missing if half or more of the input items are ** ** missing. Otherwise, missing input items are replaced with the mean of ** ** the nonmissing items. The macro call to linsum specifies the input ** ** items as a string "var_list" of variable names, and specifies the ** ** label and name of the output variable as "var_name" and "var_labl" ** ** respectively. **; %macro linsum; data first; set &INDATA; count = 0; label &var_name = "&var_labl"; meanz = 0; array sumvars &var_list; array working &var_list count meanz &var_name; do i = 1 to dim(sumvars); if working(i) = . then count = count + 1; end; do i = 1 to 1; meanz = mean(of &var_list); end ; do i = 1 to dim(sumvars) ; if working(i) = . then working(i) = meanz ; end ; do i = 1 to 1 ; if count le .5*dim(sumvars) then &var_name = sum(of &var_list)/dim(sumvars) ; else &var_name = . ; end ; keep site tcid &var_name; proc sort ; by site tcid ; data &INDATA ; merge first &INDATA ; by site tcid ; %mend linsum; *****************************************************************************; /* Copy unscored data set from SASDATA/Datasets on Jason. */ /* Sort allkey6 by SITE and TCID*/ /* Output to temp dataset akresort.*/ proc sort data=data.allkey6 out=akresort; by site tcid; run; /* Sort t&yr.bsc_copy by SITE and TCID*/ /* Output to temp dataset phresort.*/ proc sort data=data.t&yr.bsc_copy out=copyresort; by site tcid; run; data SCO; merge copyresort (in=orig) akresort (in=yes); by site tcid; drop tcid5; if cohort eq "1"; if yes then inkey ="*"; run; proc sort; by site; run; *****************************************************************************; /* Treat any undefined values as a missing value */ /* Will need revision for special missing values, e.g., .n */ DATA findmissing; SET SCO; ARRAY MISS T&yr.bSC1--T&yr.bSC25; DO OVER MISS; IF (MISS NE 0 AND MISS NE 1 AND MISS NE 2 AND MISS NE 3 AND MISS NE 4) THEN MISS=. ; END; DATA data.tallymissing; SET findmissing; MISCNT=0; ARRAY MISS T&yr.bSC1--T&yr.bSC25; DO OVER MISS; IF MISS EQ . THEN MISCNT=MISCNT+1; DROP SITECODE TEACH INTID; END; /*Dataset tallymissing has each item score, and a missing count per record.*/ /*Save this dataset so that you can calculate missing frequencies per location. */ /* Drop observations with all twelve variables missing */ /* Construct final dataset to be used for scoring by pulling out all records with all missing items. */ DATA SC4; SET data.tallymissing; IF MISCNT LT 25; /*Pull all records with a miss count under 25 into the final scoring dataset SC4. The others have all data missing and are discarded */ /* Specify definitions for SCALE VARIABLES below */ %let INDATA = SC4; ************************************************************; %let core=PRO ; %let var_name = SCT&yr.&core. ; %let var_labl = %str(Prosocial/Comm. Skills - SC_T - Year &yr.) ; %let var_list = %str(T&yr.BSC9 T&yr.BSC13 T&yr.BSC19 T&yr.BSC20 T&yr.BSC22 T&yr.BSC23 T&yr.BSC24 T&yr.BSC25) ; %linsum ; ************************************************************; %let core=REG ; %let var_name = SCT&yr.&core. ; %let var_labl = %str(Emotional Reg. Skills - SC_T - Year &yr.) ; %let var_list = %str(T&yr.BSC2 T&yr.BSC3 T&yr.BSC6 T&yr.BSC7 T&yr.BSC8 T&yr.BSC11 T&yr.BSC12 T&yr.BSC14 T&yr.BSC16 T&yr.BSC18) ; %linsum ; ************************************************************; %let core=PSR ; %let var_name = SCT&yr.&core. ; %let var_labl = %str(Prosoc + EmReg. Skills - SC_T - Year &yr.) ; %let var_list = %str(T&yr.BSC2 T&yr.BSC3 T&yr.BSC6 T&yr.BSC7 T&yr.BSC8 T&yr.BSC9 T&yr.BSC11 T&yr.BSC12 T&yr.BSC13 T&yr.BSC14 T&yr.BSC16 T&yr.BSC18 T&yr.BSC19 T&yr.BSC20 T&yr.BSC22 T&yr.BSC23 T&yr.BSC24 T&yr.BSC25) ; %linsum ; ************************************************************; %let core=ACA ; %let var_name = SCT&yr.&core. ; %let var_labl = %str(Academic Skills - SC_T - Year &yr.) ; %let var_list = %str(T&yr.BSC1 T&yr.BSC4 T&yr.BSC5 T&yr.BSC10 T&yr.BSC15 T&yr.BSC17 T&yr.BSC21) ; %linsum ; ************************************************************; %let core=TOT ; %let var_name = SCT&yr.&core. ; %let var_labl = %str(Total of all Variables - SC_T - Year &yr.) ; %let var_list = %str(T&yr.BSC1 T&yr.BSC2 T&yr.BSC3 T&yr.BSC4 T&yr.BSC5 T&yr.BSC6 T&yr.BSC7 T&yr.BSC8 T&yr.BSC9 T&yr.BSC10 T&yr.BSC11 T&yr.BSC12 T&yr.BSC13 T&yr.BSC14 T&yr.BSC15 T&yr.BSC16 T&yr.BSC17 T&yr.BSC18 T&yr.BSC19 T&yr.BSC20 T&yr.BSC21 T&yr.BSC22 T&yr.BSC23 T&yr.BSC24 T&yr.BSC25) ; %linsum ; ************************************************************; DATA data.T&yr.bscsubscores (label="Scored Social Competence - Parent - Yr&yr. Cohort 1"); SET &INDATA ; KEEP SITE COHORT TCID SCT&yr.PRO SCT&yr.REG SCT&yr.PSR SCT&yr.ACA SCT&yr.TOT T&yr.bsc1-T&yr.bsc25 TREATMNT NORM; proc sort; by site tcid; RUN;