** This program scores the Teacher Rating of School Adjustment **; ** This instrument contains 6 questions about student adjustment to middle school **; ** These are asked of multiple teachers. A score is created averaging over teachers **; ** Fill out information in next section for data ** ** Processed in this run. **; ** Name lib Holding SAS data infiles **; libname SASIN 'l:\Cohort 1\Grade 6\Teacher Measures'; ** Name lib holding SAS data for allkey file **; libname k 'j:\allkey'; ** Specify Lib for output data sets **; libname SASOUT 'd:\cmsasfiles\inprogress' ; ** Enter Cohort Number **; %let coh=1 ; ** Enter year of data collection **; %let yr=7 ; **** DO NOT MODIFY BELOW THIS LINE ****************************; data keys; set k.allkey6; data temp; set sasin.dt&yr.k&coh. sasin.nt&yr.k&coh. sasin.pt&yr.k&coh. sasin.st&yr.k&coh.; proc sort; by site tcid; run; data tempb; set temp; by site tcid; mycount=0; retain count mycount; **mycount meaures for respondent how many teachers provided ratings**; if first.tcid then count=1; else count=count+1; ntchlang=tchlang+0; ntchmath=tchmath+0; ntchsci=tchsci+0; ntchsoc=tchsoc+0; if last.tcid then mycount=count; ** separating the interviews, renaming the variables, to be able to merge the datasets **; %macro name(data1,c); data &data1; set tempb; where count=&c; array x&c[7] t&yr.k1-t&yr.k6 knowch; array v&c[4] $ tchlang tchmath tchsci tchsoc ; array y&c[7] t&c.&yr.k1-t&c.&yr.k6 knowch&c.; array w&c[4] $ t&c.chlang t&c.chmath t&c.chsci t&c.chsoc ; do i=1 to 7; y&c[i]=x&c[i]; end; drop i; do i=1 to 4; w&c[i]=v&c[i]; end; drop i; drop t&yr.k1-t&yr.k6 t&yr.ktr1-t&yr.ktr34 tchlang tchmath tchsci tchsoc ct&yr.k1-ct&yr.k6 ct&yr.ktr1-ct&yr.ktr34 cknowch ecnt edstat intid knowch schid schtype sitecode teachid year; proc sort; by site cohort tcid; run; %mend name; run; %name(rat&yr._1,1); run; %name(rat&yr._2,2); run; %name(rat&yr._3,3); run; %name(rat&yr._4,4); run; %name(rat&yr._5,5); run; ** merge the datasets, we will have a variable for each of the teacher rating for the 6 **; ** first variables, and the content items **; data all; merge rat&yr._1 rat&yr._2 rat&yr._3 rat&yr._4 rat&yr._5 ; by site cohort tcid; data temp1; set all; ** Creating the average across teachers for item 1-6 **; array a1[5] t1&yr.k1 t2&yr.k1 t3&yr.k1 t4&yr.k1 t5&yr.k1 ; count1=0; do i=1 to 5; if a1[i]=. then count1=count1+1; end; drop i; tsa&yr.stap=sum(of t1&yr.k1 t2&yr.k1 t3&yr.k1 t4&yr.k1 t5&yr.k1)/(5-count1) ; label tsa&yr.stap="TSA student academic performance yr &yr."; array a2[5] t1&yr.k2 t2&yr.k2 t3&yr.k2 t4&yr.k2 t5&yr.k2 ; count2=0; do i=1 to 5; if a2[i]=. then count2=count2+1; end; drop i; tsa&yr.stam=sum(of t1&yr.k2 t2&yr.k2 t3&yr.k2 t4&yr.k2 t5&yr.k2)/(5-count2) ; label tsa&yr.stam="TSA student academic motivation yr &yr."; array a3[5] t1&yr.k3 t2&yr.k3 t3&yr.k3 t4&yr.k3 t5&yr.k3 ; count3=0; do i=1 to 5; if a3[i]=. then count3=count3+1; end; drop i; tsa&yr.stss=sum(of t1&yr.k3 t2&yr.k3 t3&yr.k3 t4&yr.k3 t5&yr.k3)/(5-count3) ; label tsa&yr.stss="TSA student social skills yr &yr."; array a4[5] t1&yr.k4 t2&yr.k4 t3&yr.k4 t4&yr.k4 t5&yr.k4 ; count4=0; do i=1 to 5; if a4[i]=. then count4=count4+1; end; drop i; tsa&yr.star=sum(of t1&yr.k4 t2&yr.k4 t3&yr.k4 t4&yr.k4 t5&yr.k4)/(5-count4) ; label tsa&yr.star="TSA student-adult relationships yr &yr."; array a5[5] t1&yr.k5 t2&yr.k5 t3&yr.k5 t4&yr.k5 t5&yr.k5 ; count5=0; do i=1 to 5; if a5[i]=. then count5=count5+1; end; drop i; tsa&yr.stc=sum(of t1&yr.k5 t2&yr.k5 t3&yr.k5 t4&yr.k5 t5&yr.k5)/(5-count5) ; label tsa&yr.stc="TSA student conduct yr &yr."; array a6[5] t1&yr.k6 t2&yr.k6 t3&yr.k6 t4&yr.k6 t5&yr.k6 ; count6=0; do i=1 to 5; if a6[i]=. then count6=count6+1; end; drop i; tsa&yr.stpm=sum(of t1&yr.k6 t2&yr.k6 t3&yr.k6 t4&yr.k6 t5&yr.k6)/(5-count6) ; label tsa&yr.stpm="TSA student personal maturity yr &yr."; ** Merging with the allkey file **; proc sort data=temp1; by site cohort tcid; run; proc sort data=keys; by site cohort tcid; run; data all3; merge temp1(in=b) keys(in=a); by site cohort tcid; if a=1 and b=1; if treatment not="I" and cohort=1; ** this removes cases in dataset that are not in allkey **; **and intervention sample**; ** Creating permanent dataset **; data sasout.tsa&yr.st&coh. (label="Teacher rat: student adjustment y 7 c 1"); set all3; proc contents; run;