/* Disciplinary Action-Revised */ /* Count Events and Consequences */ /* Year 12, Cohort 1 */ /* Coded by Anne Corrigan */ /* Uses V8 of SAS */ /* May 21, 2003 */ /* WHAT THIS PROGRAM DOES For each occurrence of a disciplinary event for a single student (tcid), this program keeps a count of the type of event, whether the event is violent or not, and the type of consequences. The output is a dataset that contains, for each tcid: -the total number of disciplinary events; - the count of each type of event (e.g., verbal harassment, non-violent event, weapons, etc); -the count of each type of consequence (e.g., low consequence, suspension, etc.); -and the count of the number of events that were violent. For students with no events, the program outputs 0 for the accumulated count of each event. For skipped students (i.e., students who really were skipped, not just those with no events) the program outputs a record with . missing variables.*/ %let yr=12; libname data "D:\sasdata\DIA&yr.DataAll"; OPTIONS PAGESIZE = 71 REPLACE LABEL NUMBER SOURCE LINESIZE=120; data data.counts&yr.; set data.o&yr.pclean; retain ctevent ct10fight ct11harass ct12nonv ct13weapon ct14vandal ct15substance ct16evmiss ct17lowcon ct18hicon ct19suspend ct21expel ct22consmiss ct_tot_viol; do; by site tcid; /* Data is truly missing. There are 17 reasons why data could be missing. */ /* Alternative School - Behavior 13 Alternative School - Academic 17 Day Treatment 14 Dropped out of school 2 GED 3 Graduated 4 Home bound 15 Home schooled 5 Moved out of Fast Track area 6 Permission not available 7 Residential Treatment Facility 16 Runaway 8 School records are missing 9 School refusal 10 Unable to locate 11 Youth is institutionalized 12 */ if first.tcid and last.tcid and ( (o&yr.r8 = .) or (o&yr.r8= 2) or (o&yr.r8= 3) or (o&yr.r8= 4) or (o&yr.r8= 5) or (o&yr.r8= 6) or (o&yr.r8= 7) or (o&yr.r8= 8) or (o&yr.r8= 9) or (o&yr.r8= 10) or (o&yr.r8= 11) or (o&yr.r8= 12) or (o&yr.r8= 13) or (o&yr.r8= 14) or (o&yr.r8= 15) or (o&yr.r8= 16) or (o&yr.r8= 17) ) then do; output; put "missing one output"; end; /* No disciplinary events for the tcid */ /* We want to output zeros for the accumulated counts */ /* and reset them to missing when a new tcid is picked up in */ /* the next data step iteration. */ if first.tcid and last.tcid and (o&yr.r8 = '0') then do; ct_tot_viol=0; ctevent=0; ct10fight=0; ct11harass=0; ct12nonv=0; ct13weapon=0; ct14vandal=0; ct15substance=0; ct16evmiss=0; ct17lowcon=0; ct18hicon=0; ct19suspend=0; ct21expel=0; ct22consmiss=0; output; ct_tot_viol='.'; ctevent='.'; ct10fight='.'; ct11harass='.'; ct12nonv='.'; ct13weapon='.'; ct14vandal='.'; ct15substance='.'; ct16evmiss='.'; ct17lowcon='.'; ct18hicon='.'; ct19suspend='.'; ct21expel='.'; ct22consmiss='.'; end; /* One event only */ /* We want to output the accumulated counts */ /* and reset them to missing when a new tcid is picked up in */ /* the next data step iteration. Any accumulated count variable with no data is 0*/ if first.tcid and last.tcid and (o&yr.r8 = '1') then do; if tot_viol then ct_tot_viol+1; if o&yr.r8 then ctevent+1; if o&yr.r10 then ct10fight+1; if o&yr.r11 then ct11harass+1; if o&yr.r12 then ct12nonv+1; if o&yr.r13 then ct13weapon+1; if o&yr.r14 then ct14vandal+1; if o&yr.r15 then ct15substance+1; if o&yr.r16 then ct16evmiss+1; if o&yr.r17 then ct17lowcon+1; if o&yr.r18 then ct18hicon+1; if o&yr.r19 then ct19suspend+1; if o&yr.r21 then ct21expel+1; if o&yr.r22 then ct22consmiss+1; /* No accumulated events or consequences? Set count to zero */ if ct_tot_viol='.' then ct_tot_viol=0; if ctevent='.' then ctevent=0; if ct10fight='.' then ct10fight=0; if ct11harass='.' then ct11harass=0; if ct12nonv='.' then ct12nonv=0; if ct13weapon='.' then ct13weapon=0; if ct14vandal='.' then ct14vandal=0; if ct15substance='.' then ct15substance=0; if ct16evmiss='.' then ct16evmiss=0; if ct17lowcon='.' then ct17lowcon=0; if ct18hicon='.' then ct18hicon=0; if ct19suspend='.' then ct19suspend=0; if ct21expel='.' then ct21expel=0; if ct22consmiss='.' then ct22consmiss=0; output; /*Reset retained variables before the next data step iteration */ ct_tot_viol='.'; ctevent='.'; ct10fight='.'; ct11harass='.'; ct12nonv='.'; ct13weapon='.'; ct14vandal='.'; ct15substance='.'; ct16evmiss='.'; ct17lowcon='.'; ct18hicon='.'; ct19suspend='.'; ct21expel='.'; ct22consmiss='.'; end; /* Multiple events, first event */ if (first.tcid and ^last.tcid) then do; if tot_viol then ct_tot_viol+1; if (o&yr.r8 = '1') then ctevent+1; if o&yr.r10 then ct10fight+1; if o&yr.r11 then ct11harass+1; if o&yr.r12 then ct12nonv+1; if o&yr.r13 then ct13weapon+1; if o&yr.r14 then ct14vandal+1; if o&yr.r15 then ct15substance+1; if o&yr.r16 then ct16evmiss+1; if o&yr.r17 then ct17lowcon+1; if o&yr.r18 then ct18hicon+1; if o&yr.r19 then ct19suspend+1; if o&yr.r21 then ct21expel+1; if o&yr.r22 then ct22consmiss+1; end; /* Multiple events, middle events */ else if (^first.tcid and ^last.tcid) then do; if tot_viol then ct_tot_viol+1; /*else if ^tot_viol then ct_tot_viol=0;*/ if (o&yr.r8 = '1') then ctevent+1; if o&yr.r10 then ct10fight+1; if o&yr.r11 then ct11harass+1; if o&yr.r12 then ct12nonv+1; if o&yr.r13 then ct13weapon+1; if o&yr.r14 then ct14vandal+1; if o&yr.r15 then ct15substance+1; if o&yr.r16 then ct16evmiss+1; if o&yr.r17 then ct17lowcon+1; if o&yr.r18 then ct18hicon+1; if o&yr.r19 then ct19suspend+1; if o&yr.r21 then ct21expel+1; if o&yr.r22 then ct22consmiss+1; end; /* Multiple events, last event. We want to output the accumulated counts */ /* and reset them to missing when a new tcid is picked up in */ /* the next data step iteration. */ else if (^first.tcid and last.tcid) then do; if tot_viol then ct_tot_viol+1; if (o&yr.r8 = '1') then ctevent+1; if o&yr.r10 then ct10fight+1; if o&yr.r11 then ct11harass+1; if o&yr.r12 then ct12nonv+1; if o&yr.r13 then ct13weapon+1; if o&yr.r14 then ct14vandal+1; if o&yr.r15 then ct15substance+1; if o&yr.r16 then ct16evmiss+1; if o&yr.r17 then ct17lowcon+1; if o&yr.r18 then ct18hicon+1; if o&yr.r19 then ct19suspend+1; if o&yr.r21 then ct21expel+1; if o&yr.r22 then ct22consmiss+1; /* No accumulated events or consequences? Set count to zero */ if ct_tot_viol='.' then ct_tot_viol=0; if ctevent='.' then ctevent=0; if ct10fight='.' then ct10fight=0; if ct11harass='.' then ct11harass=0; if ct12nonv='.' then ct12nonv=0; if ct13weapon='.' then ct13weapon=0; if ct14vandal='.' then ct14vandal=0; if ct15substance='.' then ct15substance=0; if ct16evmiss='.' then ct16evmiss=0; if ct17lowcon='.' then ct17lowcon=0; if ct18hicon='.' then ct18hicon=0; if ct19suspend='.' then ct19suspend=0; if ct21expel='.' then ct21expel=0; if ct22consmiss='.' then ct22consmiss=0; output; /*Reset retained variables before the next data step iteration */ ct_tot_viol='.'; ctevent='.'; ct10fight='.'; ct11harass='.'; ct12nonv='.'; ct13weapon='.'; ct14vandal='.'; ct15substance='.'; ct16evmiss='.'; ct17lowcon='.'; ct18hicon='.'; ct19suspend='.'; ct21expel='.'; ct22consmiss='.'; end; end; label ct_tot_viol="Count of Violence-total acts" ctevent="Count of o&yr.r8-Events" ct10fight="Count of o&yr.r10-Fighting" ct11harass="Count of o&yr.r11-Verbal harassment" ct12nonv="Count of o&yr.r12-Non-violent" ct13weapon="Count of o&yr.r13-Weapons" ct14vandal="Count of o&yr.r14-Vandalism/theft" ct15substance="Count of o&yr.r15-Controlled substance" ct16evmiss="Count of o&yr.r16-Reason for action missing" ct17lowcon="Count of o&yr.r17-Low consequence" ct18hicon="Count of o&yr.r18-High consequence" ct19suspend="Count of o&yr.r19-Suspension" ct21expel="Count of o&yr.r21-Expulsion" ct22consmiss="Count of o&yr.r22-Consequences missing"; run;