SAS program to create derived dataset ************************************************************************** * PROGRAM: TPract_tech * DATE: April 24, 2002 * AUTHOR: BRENDA HEINRICHS *************************************************************************; options ls=120 nodate nocenter pageno = 1 probsig = 2 skip = 2 number = 0 label = 1 ps = 40; data data5a (drop = CT5GC1 CT5GC2 CT5GC3 CT5GC4 CT5GC5 CT5GC6 CT5GC7 CT5GC8 CT5GC9 CT5GG1 CT5GG2 CT5GG3 CT5GG4 CT5GG5 CT5GG6 CT5GS1 CT5GS2 CT5GS3A CT5GS3B CT5GS3C CT5GS3D CT5GS3E CT5GS4A CT5GS4B CT5GS4C CT5GS4D CT5GS4E grade); set tpract.t5g; data5 = 1; rename T5GC1 = TGC1 T5GC2 = TGC2 T5GC3 = TGC3 T5GC4 = TGC4 T5GC5 = TGC5 T5GC6 = TGC6 T5GC7 = TGC7 T5GC8 = TGC8 T5GC9 = TGC9 T5GG1 = TGG1 T5GG2 = TGG2 T5GG3 = TGG3 T5GG4 = TGG4 T5GG5 = TGG5 T5GG6 = TGG6 T5GS1 = TGS1 T5GS2 = TGS2 T5GS3A = TGS3A T5GS3B = TGS3B T5GS3C = TGS3C T5GS3D = TGS3D T5GS3E = TGS3E T5GS4A = TGS4A T5GS4B = TGS4B T5GS4C = TGS4C T5GS4D = TGS4D T5GS4E = TGS4E; g = grade * 1; original_grade = grade; run; data data6a (drop = CT6GC1 CT6GC2 CT6GC3 CT6GC4 CT6GC5 CT6GC6 CT6GC7 CT6GC8 CT6GC9 CT6GG1 CT6GG2 CT6GG3 CT6GG4 CT6GG5 CT6GG6 CT6GS1 CT6GS2 CT6GS3A CT6GS3B CT6GS3C CT6GS3D CT6GS3E CT6GS4A CT6GS4B CT6GS4C CT6GS4D CT6GS4E grade ); set tpract.t6g; data6 = 1; rename T6GC1 = TGC1 T6GC2 = TGC2 T6GC3 = TGC3 T6GC4 = TGC4 T6GC5 = TGC5 T6GC6 = TGC6 T6GC7 = TGC7 T6GC8 = TGC8 T6GC9 = TGC9 T6GG1 = TGG1 T6GG2 = TGG2 T6GG3 = TGG3 T6GG4 = TGG4 T6GG5 = TGG5 T6GG6 = TGG6 T6GS1 = TGS1 T6GS2 = TGS2 T6GS3A = TGS3A T6GS3B = TGS3B T6GS3C = TGS3C T6GS3D = TGS3D T6GS3E = TGS3E T6GS4A = TGS4A T6GS4B = TGS4B T6GS4C = TGS4C T6GS4D = TGS4D T6GS4E = TGS4E; g = grade * 1; original_grade = grade; run; * assign class; data data56a (drop = sitecode schlid tchid intid e t end g ); length site $1; length t $2; length class $8; set data5a data6a; Tpractgrade = g; if site = 'D' then delete; site = substr (site,1,1); school = sitecode||schlid; teacher = school||"0"||tchid; interviewer = sitecode||"0"||intid; * making class variable for merging with other data set; t = substr (teacher, 6,2); front = trim (school||t); end = compbl(calyear); class = compbl (front||end); run; data teacherinfo (drop = pathstat ); set tpract.teacherinfo; run; proc sort data = data56a; by class; run; proc sort data = teacherinfo; by class; run; data data56b (drop = sitecode grade teacher_file) ; merge data56a teacherinfo; by class; if class eq '20041996' then data5 = 1 ; if data5 = 1 or data6 = 1; * making variable that indicates split classroom; split = 1; if grade = 1 or grade = 2 or grade = 3 or grade = 4 or grade = 5 or grade = 6 then split = 0; if tpractgrade = 3.5 or tpractgrade = 4.5 or tpractgrade = 5.5 then split = 1; if grade = 98 then delete; pathstat = .; if school = '0002' or school = '0007' or school = '0009' or school = '0011' or school = '0013' or school = '0014' or school = '0003' or school = '0006' or school = '1000' or school = '1003' or school = '1005' or school = '1007' or school = '1008' or school = '1099' or school = '3001' or school = '3003' or school = '3005' or school = '3008' or school = '3010' or school = '3013' or school = '3015' or school = '2001' or school = '2003' or school = '2004' or school = '2040' or school = '2041' or school = '2042' or school = '2009' then pathstat = 1; if school = '0001' or school = '0004' or school = '0005' or school = '0008' or school = '0010' or school = '0012' or school = '1004' or school = '1006' or school = '1009' or school = '3002' or school = '3004' or school = '3006' or school = '3007' or school = '3009' or school = '3012' or school = '3014' or school = '3016' or school = '3017' or school = '3020' or school = '2005' or school = '2005' or school = '2007' or school = '2006' or school = '2008' or school = '2043' or school = '2044' or school = '2045' or school = '2046' then pathstat = 0; if pathstat ne . then core = 1; else core = 0; * 05/10/02--making head middle school a core school for these analyses; if school = '1105' then core = 1; year = 5; if data6 = 1 then year = 6; * renaming grade variable so that we can check it with data in teacher files that already has grade variable; *Tpractgrade = grade *1; cyear = calyear*1; * reversing some scales; array rev tgc5 tgc6 tgc8 tgs3c tgs3d tgs4c tgs4d; do over rev; if rev = 4 then rev = rev + 1; if rev = 3 then rev = rev + 3; if rev = 2 then rev = rev + 5; if rev = 1 then rev = rev + 7; if rev = 0 then rev = rev + 9; rev = rev - 5; end; * remember to relable these variables to note that values have been reversed; label tgc5 = 'Class Puts Each Other Down-Rev'; label tgc6 = 'Class Frequently Argues-Rev'; label tgc8 = 'Class is Hard to Control-Rev'; label tgs3c = 'Teacher Solves Minor Conflit-Rev'; label tgs3d = 'Send to Office for Minor Conflict-Rev'; label tgs4c = 'Teacher Solves Major Conflit-Rev'; label tgs4d = 'Send to Office for Major Conflict-Rev'; * 03/12/02 Dichotomized all goals variables (TGG*)--0-3 = 0 4-5 = 1 after meeting with Mark earlier in day.; * 08/22/02 changed the method of dichotimization so that new variable is created; tgg1D = 0;tgg2D = 0;tgg3D = 0;tgg4D = 0; tgg5D = 0;tgg6D = 0; if tgg1 > 3 then tgg1D = 1; if tgg2 > 3 then tgg2D = 1; if tgg3 > 3 then tgg3D = 1; if tgg4 > 3 then tgg4D = 1; if tgg5 > 3 then tgg5D = 1; if tgg6 > 3 then tgg6D = 1; label tgg1d = 'Goal - the Basics (D)'; label tgg2d = 'Goal - Social Competence (D)'; label tgg3d = 'Goal - Critical Thinking (D)'; label tgg4d = 'Goal - Considerate Behavior (D)'; label tgg5d = 'Goal - Creativity (D)'; label tgg6d = 'Goal - Democratic Values (D)'; * resolving split classes--remember that we have a variable describing if it is a split classroom; if grade = 24 and tpractgrade = 3.5 then tpractgrade = 4; if grade = 34 and tpractgrade = 3.5 then tpractgrade = 4; if grade = 34 and tpractgrade = 4.5 then tpractgrade = 4; if grade = 46 and tpractgrade = 5.5 then tpractgrade = 4; if grade = 56 and tpractgrade = 5.5 then tpractgrade = 4; if grade = 4 and tpractgrade = 4.5 then tpractgrade = 4; if grade = 5 and tpractgrade = 5.5 then tpractgrade = 5; * using pgrade info where we can; if grade = 35 and pgrade = 5 then tpractgrade = 5; if grade = 35 and pgrade = 4 then tpractgrade = 4; if grade = 45 and pgrade = 5 then tpractgrade = 5; if grade = 45 and pgrade = 4 then tpractgrade = 4; *using what file the data was found in???????????I hope this one is good correction; *if tpractgrade = 3.5 and data5 = 1 then tpractgrade = 4; if tpractgrade = 4.5 and data5 = 1 then tpractgrade = 4; if tpractgrade = 4.5 and data6 = 1 then tpractgrade = 5; if tpractgrade = 5.5 and data6 = 1 then tpractgrade = 5; * error corrections; * 03/01/02; if site = 'W' and Tpractgrade = 4 and grade = 56 then tpractgrade = 5; if site = 'W' and season = 'W' then season = 'S'; if site = 'W' and tpractgrade = 6 then delete; * 03/01/02--; if tpractgrade = 3 then delete; * 03/05/02, 03/13/02 found out it was not split and grade 4; *if '20041996' <= class <= '20041996' then data5 = 1 ; if class = '20041996' then grade = 4 ; if class eq '20041996' then data6 = . ; if class = '20041996' then year = 5; if class = '20041996' then split = 0 ; * 03/13/02; if class = '10081897' then grade = TPractgrade = 5; * 03/21/02; if class = '10070997' then TPractgrade = 5; if class = '10072297' then TPractgrade = 5; * making other factors of interest; *goals = tgg1 + tgg2 + tgg3 + tgg4 + tgg5 + tgg6 ; classmed = tgs2 + tgs3e + tgs4e; studentmed = tgs3a + tgs4a; teachmed = tgs3b + tgs4b; classcompare = tgc1+ tgc2+ tgc3 +tgc4 +tgc5 +tgc6 +tgc7 +tgc8 +tgc9; label site = 'Site'; data56b = 1; run; * Now, that we have recreated the data set that has been error checked, we have to change the grade 5 Nashville data. Both middle schools were assigned to intervention, however, Paths apparently was taught only if there was a control target child in the class. Therefore, we must assign Paths status by the class room. Paths status will be determined by whether it was evaluated by an EC.; data data56c; set data56b; school2 = school; if class = '10070796' or class = '10070896' or class = '10070897' or class = '10070898' or class = '10070996' or class = '10071096' or class = '10071196' or class = '10071296' or class = '10071396' or class = '10072297' or class = '10081597' or class = '10081896' or class = '10990496' or class = '10990596' or class = '10990696' or class = '10990796' or class = '10990896' or class = '11050597' or class = '11050697' or class = '11051597' then pathstat = 0; if class = '10070796' or class = '10070896' or class = '10070897' or class = '10070898' or class = '10070996' or class = '10071096' or class = '10071196' or class = '10071296' or class = '10071396' or class = '10072297' then school2 = '1907'; if class = '10081597' or class = '10081896' then school2 = '1908'; if class = '10990496' or class = '10990596' or class = '10990696' or class = '10990796' or class = '10990896' then school2 = '1999'; run; data TPract.Tpract_tech; set data56c; run; ************************************************************************** * PROGRAM: TPract_techB * DATE: October 10, 2002 * AUTHOR: BRENDA HEINRICHS * PURPOSE: Part two of making data for tech report. Here the data is split in year 5 and 6 by grade and the variables are reformatted into the same form as in the original data sets off the server. *************************************************************************; options ls=120 nodate nocenter pageno = 1 probsig = 2 skip = 2 number = 0 label = 1 ps = 40; * first split up by grade; data tech14; attrib tpractgrade length = 3.;set tpract.tpract_tech; if tpractgrade = 4; run; data tech15; set tpract.tpract_tech; if tpractgrade = 5; run; * work with grade 4 first. The code will be repeated for grade 5; data tech24 (drop = class core data5 data6 data56b front pathstat pgrade school2 year cyear school teacher interviewer) ; length site $4; set tech14; rename original_grade = grade; if site = 'N' then site = 'NASH'; if site = 'P' then site = 'PENN'; if site = 'W' then site = 'WASH'; INTID = substr (interviewer,2,3); label INTID = 'Interviewer I.D. Number'; SCHLID = substr (school,2,3); label SCHLID = 'School I.D. Number'; TCHID = substr (teacher,6,2); label TCHID = 'Teacher I.D. Number'; sitecode = substr (school,1,1); *grade = input(put(tpractgrade,best3.),$3.); rename TGC1 = T5GC1 TGC2 = T5GC2 TGC3 = T5GC3 TGC4 = T5GC4 TGC5 = T5GC5 TGC6 = T5GC6 TGC7 = T5GC7 TGC8 = T5GC8 TGC9 = T5GC9 TGG1 = T5GG1 TGG2 = T5GG2 TGG3 = T5GG3 TGG4 = T5GG4 TGG5 = T5GG5 TGG6 = T5GG6 TGS1 = T5GS1 TGS2 = T5GS2 TGS3A = T5GS3A TGS3B = T5GS3B TGS3C = T5GS3C TGS3D = T5GS3D TGS3E = T5GS3E TGS4A = T5GS4A TGS4B = T5GS4B TGS4C = T5GS4C TGS4D = T5GS4D TGS4E = T5GS4E; rename TGG1D = T5GG1D TGG2D = T5GG2D TGG3D = T5GG3D TGG4D = T5GG4D TGG5D = T5GG5D TGG6D = T5GG6D; label tpractgrade = 'Grade Level Using Teacher Info.'; label split = 'Split Classroom: 1 = yes'; rename classmed = classmed5 teachmed = teachmed5 studentmed = studentmed5 classcompare = classcompare5; run; * test 'set' with server data for format consistency; /* passes--formats agree data test1; set tpract.t5g tech24; run;*/ * now work with grade 5. ; data tech25 (drop = class core data5 data6 data56b front pathstat pgrade school2 year cyear school teacher interviewer) ; length site $4; set tech15; rename original_grade = grade; if site = 'N' then site = 'NASH'; if site = 'P' then site = 'PENN'; if site = 'W' then site = 'WASH'; INTID = substr (interviewer,2,3); label INTID = 'Interviewer I.D. Number'; SCHLID = substr (school,2,3); label SCHLID = 'School I.D. Number'; TCHID = substr (teacher,6,2); label TCHID = 'Teacher I.D. Number'; sitecode = substr (school,1,1); *grade = input(put(tpractgrade,best3.),$3.); rename TGC1 = T6GC1 TGC2 = T6GC2 TGC3 = T6GC3 TGC4 = T6GC4 TGC5 = T6GC5 TGC6 = T6GC6 TGC7 = T6GC7 TGC8 = T6GC8 TGC9 = T6GC9 TGG1 = T6GG1 TGG2 = T6GG2 TGG3 = T6GG3 TGG4 = T6GG4 TGG5 = T6GG5 TGG6 = T6GG6 TGS1 = T6GS1 TGS2 = T6GS2 TGS3A = T6GS3A TGS3B = T6GS3B TGS3C = T6GS3C TGS3D = T6GS3D TGS3E = T6GS3E TGS4A = T6GS4A TGS4B = T6GS4B TGS4C = T6GS4C TGS4D = T6GS4D TGS4E = T6GS4E; rename TGG1D = T6GG1D TGG2D = T6GG2D TGG3D = T6GG3D TGG4D = T6GG4D TGG5D = T6GG5D TGG6D = T6GG6D; label tpractgrade = 'Grade Level Using Teacher Info.'; label split = 'Split Classroom: 1 = yes'; rename classmed = classmed6 teachmed = teachmed6 studentmed = studentmed6 classcompare = classcompare6; run; * test 'set' with server data for format consistency; /* passes formats agree. data test2; set tpract.t6g tech25; run;*/ data tpract.t5g_scored; set tech24; run; data tpract.t6g_scored; set tech25; run;