****************************************************************** * * * PROGRAM : TPRxSTxR.SAS * * * * PROGRAMMER : Anne Maumary-Gremaud (modified by Pamela * * Ahrens, 10/27/97 - added tcid to KEEP) (Mod- * * ified again by Anne Corrigan to add item info * * to the keep statement.) * * * PURPOSE : Create a SAS dataset containing derived * * variables from the TxEx datasets. * * Program can be modified to process TxEx data * * from any cohort or year by setting severals * * parameters at beginning of program. * * * * INPUT : Datasets containing elemental SAS variables * * for each sites (xTxEx) * * * * OUPUT : SAS dataset containing the derived variables * * * ******************************************************************; ** Enter year of data collection **; %let yr = 3; ** Fill out information in next section for data ** ** Processed in this run. **; ** Name lib Holding SAS data infiles **; * libname SASIN "d:\sasdata\t&yr.e1DataAll"; libname SASIN "d:\sasdata\t&yr.e1DataAll"; ** Specify Lib for output data sets **; * libname SASOUT 'j:/fastrack/prog_scr/sas' ; * libname SASOUT 'g:\pkawork\checkdata' ; libname SASOUT "d:\sasdata\t&yr.e1DataAll"; ** Enter Cohort Number **; %let coh=1; /**************************Merge with allkey**********************************/ **** DO NOT MODIFY BELLOW THIS LINE ****************************; data temp; set SASIN.t&yr.eclean; /*t&yr.eclean is a dataset that has been processed--merged with a key for sites and sample types -- and includes only cohort 1. The statements below create a dataset that includes for all sites, using a defined cohort. They were not needed in the scoring run, since we did some preprocessing. */ /* set SASIN.DT&yr.E&coh. SASIN.NT&yr.E&coh. SASIN.PT&yr.E&coh. SASIN.ST&yr.E&coh. ; */ ** Handling missing values **; data first; set temp; count1=0; count2=0; array academic[*] T&yr.E1 T&yr.E2; array prosoc[*] T&yr.E3 T&yr.E4 T&yr.E5 T&yr.E6 T&yr.E7 T&yr.E8 T&yr.E9 T&yr.E10; sum1=sum(of academic[*]); sum2=sum(of prosoc[*]); do i=1 to 2; if academic[i] = . then count1 = count1 + 1; end; drop i; do i=1 to 2; if count1 le 1 then if academic[i] =. then academic[i]=sum1/(2-count1); end; drop i; do i=1 to 8; if prosoc[i]=. then count2=count2+1; end; drop i; do i=1 to 8; if count2 le 4 then if prosoc[i]=. then prosoc[i]=sum2/(8-count2); end; drop i; /** Creating the scales **/ TPR&yr.ACA=(T&yr.E1+T&yr.E2)/2; TPR&yr.PRO=(T&yr.E3+T&yr.E4+T&yr.E5+T&yr.E6+T&yr.E7+T&yr.E8+T&yr.E9+T&yr.E10)/8; /* TPR&yr.PRONOTEN=(T&yr.E3+T&yr.E4+T&yr.E5+T&yr.E6+T&yr.E7+T&yr.E8+T&yr.E9)/7; */ label TPR&yr.ACA="TRP_ Academics mean score YR &yr." /* TPR&yr.PRONOTEN="TPR_ Prosocial Behavior-no self esteem-mean score YR &yr." */ TPR&yr.PRO="TPR_ Prosocial Behavior mean score YR &yr."; ** Setting the permanent SAS dataset **; data SASOUT.TPR&yr.ST&coh. (LABEL = "Scored Teacher Post Ratings Y&yr."); set first; keep cohort site tcid treatmnt norm tpr&yr.aca tpr&yr.pro T&yr.E1-T&yr.E10; /* tpr&yr.pronoten */ run; proc contents; run;