/* Disciplinary Action */ /* Count Events and Consequences */ /* Year 11, 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 number of events and .S for the event and consequence types. 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=11; 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 ct7fight ct8harass ct9nonv ct10weapon ct11vandal ct12substance ct13evmiss ct14lowcon ct15hicon ct16suspend ct18expel ct19consmiss ct_tot_viol; do; by site tcid; /* Data is truly missing. */ if first.tcid and last.tcid and (o&yr.p5 = .) 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.p5 = '0') then do; put "no events (before counting)"; put "ctevent ct7fight ct8harass ct_tot_viol"; put ctevent ct7fight ct8harass ct_tot_viol ; ct_tot_viol=0; ctevent=0; ct7fight=0; ct8harass=0; ct9nonv=0; ct10weapon=0; ct11vandal=0; ct12substance=0; ct13evmiss=0; ct14lowcon=0; ct15hicon=0; ct16suspend=0; ct18expel=0; ct19consmiss=0; put "no event after counting"; put "ctevent ct7fight ct8harass ct_tot_viol"; put ctevent ct7fight ct8harass ct_tot_viol ; output; ct_tot_viol='.'; ctevent='.'; ct7fight='.'; ct8harass='.'; ct9nonv='.'; ct10weapon='.'; ct11vandal='.'; ct12substance='.'; ct13evmiss='.'; ct14lowcon='.'; ct15hicon='.'; ct16suspend='.'; ct18expel='.'; ct19consmiss='.'; 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.p5 = '1') then do; put "the only event date before counting"; put "ctevent ct7fight ct8harass ct_tot_viol"; put ctevent ct7fight ct8harass ct_tot_viol ; if tot_viol then ct_tot_viol+1; if o&yr.p5 then ctevent+1; if o&yr.p7 then ct7fight+1; if o&yr.p8 then ct8harass+1; if o&yr.p9 then ct9nonv+1; if o&yr.p10 then ct10weapon+1; if o&yr.p11 then ct11vandal+1; if o&yr.p12 then ct12substance+1; if o&yr.p13 then ct13evmiss+1; if o&yr.p14 then ct14lowcon+1; if o&yr.p15 then ct15hicon+1; if o&yr.p16 then ct16suspend+1; if o&yr.p18 then ct18expel+1; if o&yr.p19 then ct19consmiss+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 ct7fight='.' then ct7fight=0; if ct8harass='.' then ct8harass=0; if ct9nonv='.' then ct9nonv=0; if ct10weapon='.' then ct10weapon=0; if ct11vandal='.' then ct11vandal=0; if ct12substance='.' then ct12substance=0; if ct13evmiss='.' then ct13evmiss=0; if ct14lowcon='.' then ct14lowcon=0; if ct15hicon='.' then ct15hicon=0; if ct16suspend='.' then ct16suspend=0; if ct18expel='.' then ct18expel=0; if ct19consmiss='.' then ct19consmiss=0; put "the only date after counting"; put "ctevent ct7fight ct8harass ct_tot_viol"; put ctevent ct7fight ct8harass ct_tot_viol ; output; /*Reset retained variables before the next data step iteration */ ct_tot_viol='.'; ctevent='.'; ct7fight='.'; ct8harass='.'; ct9nonv='.'; ct10weapon='.'; ct11vandal='.'; ct12substance='.'; ct13evmiss='.'; ct14lowcon='.'; ct15hicon='.'; ct16suspend='.'; ct18expel='.'; ct19consmiss='.'; end; /* Multiple events, first event */ if (first.tcid and ^last.tcid) then do; put "mult. dates--first date- before counting"; put "ctevent ct7fight ct8harass ct_tot_viol"; put ctevent ct7fight ct8harass ct_tot_viol ; if tot_viol then ct_tot_viol+1; if o&yr.p5 then ctevent+1; if o&yr.p7 then ct7fight+1; if o&yr.p8 then ct8harass+1; if o&yr.p9 then ct9nonv+1; if o&yr.p10 then ct10weapon+1; if o&yr.p11 then ct11vandal+1; if o&yr.p12 then ct12substance+1; if o&yr.p13 then ct13evmiss+1; if o&yr.p14 then ct14lowcon+1; if o&yr.p15 then ct15hicon+1; if o&yr.p16 then ct16suspend+1; if o&yr.p18 then ct18expel+1; if o&yr.p19 then ct19consmiss+1; put "mult. dates--first date-after counting"; put "ctevent ct7fight ct8harass ct_tot_viol"; put ctevent ct7fight ct8harass ct_tot_viol ; end; /* Multiple events, middle events */ else if (^first.tcid and ^last.tcid) then do; put "mult. dates--middle date before counting"; put "ctevent ct7fight ct8harass ct_tot_viol"; put ctevent ct7fight ct8harass ct_tot_viol ; if tot_viol then ct_tot_viol+1; /*else if ^tot_viol then ct_tot_viol=0;*/ if o&yr.p5 then ctevent+1; if o&yr.p7 then ct7fight+1; if o&yr.p8 then ct8harass+1; if o&yr.p9 then ct9nonv+1; if o&yr.p10 then ct10weapon+1; if o&yr.p11 then ct11vandal+1; if o&yr.p12 then ct12substance+1; if o&yr.p13 then ct13evmiss+1; if o&yr.p14 then ct14lowcon+1; if o&yr.p15 then ct15hicon+1; if o&yr.p16 then ct16suspend+1; if o&yr.p18 then ct18expel+1; if o&yr.p19 then ct19consmiss+1; put "mult dates--middle date after counting"; put "ctevent ct7fight ct8harass ct_tot_viol"; put ctevent ct7fight ct8harass ct_tot_viol ; 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; put "mult. dates--last date before counting"; put "ctevent ct7fight ct8harass ct_tot_viol"; put ctevent ct7fight ct8harass ct_tot_viol ; if tot_viol then ct_tot_viol+1; if o&yr.p5 then ctevent+1; if o&yr.p7 then ct7fight+1; if o&yr.p8 then ct8harass+1; if o&yr.p9 then ct9nonv+1; if o&yr.p10 then ct10weapon+1; if o&yr.p11 then ct11vandal+1; if o&yr.p12 then ct12substance+1; if o&yr.p13 then ct13evmiss+1; if o&yr.p14 then ct14lowcon+1; if o&yr.p15 then ct15hicon+1; if o&yr.p16 then ct16suspend+1; if o&yr.p18 then ct18expel+1; if o&yr.p19 then ct19consmiss+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 ct7fight='.' then ct7fight=0; if ct8harass='.' then ct8harass=0; if ct9nonv='.' then ct9nonv=0; if ct10weapon='.' then ct10weapon=0; if ct11vandal='.' then ct11vandal=0; if ct12substance='.' then ct12substance=0; if ct13evmiss='.' then ct13evmiss=0; if ct14lowcon='.' then ct14lowcon=0; if ct15hicon='.' then ct15hicon=0; if ct16suspend='.' then ct16suspend=0; if ct18expel='.' then ct18expel=0; if ct19consmiss='.' then ct19consmiss=0; put "mult dates--last date after counting"; put "ctevent ct7fight ct8harass ct_tot_viol"; put ctevent ct7fight ct8harass ct_tot_viol ; output; /*Reset retained variables before the next data step iteration */ ct_tot_viol='.'; ctevent='.'; ct7fight='.'; ct8harass='.'; ct9nonv='.'; ct10weapon='.'; ct11vandal='.'; ct12substance='.'; ct13evmiss='.'; ct14lowcon='.'; ct15hicon='.'; ct16suspend='.'; ct18expel='.'; ct19consmiss='.'; end; end; label ct_tot_viol="Count of Violence-total acts" ctevent="Count of o&yr.p5-Events" ct7fight="Count of o&yr.p7-Fighting" ct8harass="Count of o&yr.p8-Verbal harassment" ct9nonv="Count of o&yr.p9-Non-violent" ct10weapon="Count of o&yr.p10-Weapons" ct11vandal="Count of o&yr.p11-Vandalism/theft" ct12substance="Count of o&yr.p12-Controlled substance" ct13evmiss="Count of o&yr.p13-Reason for action missing" ct14lowcon="Count of o&yr.p14-Low consequence" ct15hicon="Count of o&yr.p15-High consequence" ct16suspend="Count of o&yr.p16-Suspension" ct18expel="Count of o&yr.p18-Expulsion" ct19consmiss="Count of o&yr.p19-Consequences missing"; run;