/* LOS_ENTRY_YR_AGE_0-17yr.sas */ /* Purpose: Use Event history analysis to compute median length of stay * by AGE group [CW spell=1 only]. * Original Programmer: Daniel Webster * REVSION HISTORY: * 9-14-2009-created to provide yearly cohort los estimates by age * 4-12-2010-began running data for 2007 entry cohort * 10-14-2010-divided infant category into neonates (<1mo) and others (1-11mo) * 4-20-2011-added 2008 entry cohorts * 2-10-2011-added 2009 entry cohorts * 5-22-2012-modified filename to specify 0-17yr old entries to * 2-19-2012-added 2010 entry cohorts * 2-14-2014-added 2011 entry cohorts * accommodate new AB12 programs & files that will reference 0-20yr old entries * Project: CWS/CMS Performance Indicators */ options nodate nocenter nonumber ls=90; data tmp0; set dwh.ucb_fc_afcars; if A34_SPELL = 1 then SP = 1; else if A34_SPELL ge 2 then SP = 2; run; data tmp1; set tmp0; where SP = 1; timein=.; if pe_e_dt = . then do; timein=&CUTOFF -pe_s_dt; end; if pe_e_dt ne . then do; timein=pe_e_dt-pe_s_dt; end; run; /*restrict to children in care 8+ days*/ data tmp1; set tmp1; where timein ge 8; run; /*restrict to one record per child*/ data temp1a; set tmp1; by FKCLIENT_T; if last.FKCLIENT_T; /* lagdays */ lagdays = .; if (PE_E_DT = .) then do; lagdays = int(&CUTOFF-PE_S_DT); end; if (PE_E_DT ge '01jan88'd) then do; lagdays = int(PE_E_DT-PE_S_DT); end; /* in */ in = .; if (PE_E_DT = .) then in = 1; else if (PE_E_DT ne . and PE_E_DT ge '01jan88'd) then in = 0; first_yr=year(pe_s_dt); /*updated age calculation*/ age = floor((intck('month',birth_dt,pe_s_dt)-(day(pe_s_dt) lt day(birth_dt)))/12); age2 = (pe_s_dt-birth_dt); race=ethnic*1; GENDER=.; if GENDER_CD='F' then GENDER=1; else if GENDER_CD='M' then GENDER=2; else if GENDER_CD='I' then GENDER=3; run; %macro REPORTYEAR(START,STOP) ; %do ENTYR = &START %to &STOP ; /*restrict entry cohort years and entries age 0-17 years, ethnic and gender not missing*/ data temp3; set temp1a; where (FIRST_YR = &ENTYR) and age between 0 and 17 AND race in (1,2,3,4,5) and GENDER ne .; AGEGRP=.; if age in (0) then AGEGRP=1; else if age in (1,2) then AGEGRP=2; else if age in (3,4,5) then AGEGRP=3; else if age in (6,7,8,9,10) then AGEGRP=4; else if age in (11,12,13,14,15) then AGEGRP=5; else if age in (16,17) then AGEGRP=6; COUNTY=rsp_cnty*1; AGEGRP2=AGEGRP; if agegrp in (1) then do; if age2 lt 29 then AGEGRP2=1; else AGEGRP2=1.5; end; run; /*remove missing placement type*/ data temp3a; set temp3; if AGEGRP2=. then AGEGRP2=99; if COUNTY in (59,98,99,.) then COUNTY=98; run; /* state */ proc sort data = temp3a; by AGEGRP2; run; /*quartiles*/ ods output quartiles=mlos1; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by AGEGRP2; run; data mlos1; set mlos1; where AGEGRP2 ne .; run; ods output quartiles=mlos1a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); run; data mlos1a; set mlos1a; AGEGRP2=100; run; data mlosfac1; set mlos1 mlos1a ; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; run; proc sort data=temp3a; by county AGEGRP2; run; ods output quartiles=mlos2; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county AGEGRP2; run; data mlos2; set mlos2; where AGEGRP2 ne 7; /*drop missing AGEGRP group*/ drop stratum; run; ods output quartiles=mlos2a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county; run; data mlos2a; set mlos2a; AGEGRP2=100; run; data mlosfac2; set mlos2 mlos2a; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; cal=1; run; data mlosfac3; set mlosfac1 mlosfac2; if county=. Then county=0; else if county in (59,98,99,.) then county = 98; run; /*change values of missing point estimates such that proc format [sfmt] will assign a "**" while misstext in tabulate will assign a blank -- to differentiate between a non-calculable estimate and one where there is no underlying data*/ data mlos&ENTYR; set mlosfac3; if pe1=. then pe1=0; if pe2=. then pe2=0; if pe3=. then pe3=0; PERIOD_DT = &ENTYR; TYPE = 1; /* AGE 0-17 */ GROUP = 2; /* AGE */ rename AGEGRP2 = AGE17A GENDER = GENDER_CD race = ETHNIC; run; proc append base = local.mlos_AGE17 data = mlos&ENTYR; run; %end; %mend REPORTYEAR ; %REPORTYEAR(2004,2023); /* LOS_ENTRY_YR_AGE_0-20yr.sas */ /* Purpose: Use Event history analysis to compute median length of stay * by AGE group [CW spell=1 only]. * Original Programmer: Daniel Webster * REVSION HISTORY: * 9-14-2009-created to provide yearly cohort los estimates by age * 4-12-2010-began running data for 2007 entry cohort * 10-14-2010-divided infant category into neonates (<1mo) and others (1-11mo) * 4-20-2011-added 2008 entry cohorts * 2-10-2011-added 2009 entry cohorts * 5-22-2012-modified filename to specify 0-20yr old entries to * accommodate new AB12 programs & files that will reference 0-20yr old entries * 2-19-2013-added 2010 entry cohorts * 2-14-2014-added 2011 entry cohorts * Project: CWS/CMS Performance Indicators */ data tmp0; set dwh.ucb_fc_afcars; if A34_SPELL = 1 then SP = 1; else if A34_SPELL ge 2 then SP = 2; run; data tmp1; set tmp0; where SP = 1; timein=.; if pe_e_dt = . then do; timein=&CUTOFF -pe_s_dt; end; if pe_e_dt ne . then do; timein=pe_e_dt-pe_s_dt; end; run; /*restrict to children in care 8+ days*/ data tmp1; set tmp1; where timein ge 8; run; /*restrict to one record per child*/ data temp1a; set tmp1; by FKCLIENT_T; if last.FKCLIENT_T; /* lagdays */ lagdays = .; if (PE_E_DT = .) then do; lagdays = int(&CUTOFF-PE_S_DT); end; if (PE_E_DT ge '01jan88'd) then do; lagdays = int(PE_E_DT-PE_S_DT); end; /* in */ in = .; if (PE_E_DT = .) then in = 1; else if (PE_E_DT ne . and PE_E_DT ge '01jan88'd) then in = 0; first_yr=year(pe_s_dt); /*updated age calculation*/ age = floor((intck('month',birth_dt,pe_s_dt)-(day(pe_s_dt) lt day(birth_dt)))/12); age2 = (pe_s_dt-birth_dt); race=ethnic*1; GENDER=.; if GENDER_CD='F' then GENDER=1; else if GENDER_CD='M' then GENDER=2; else if GENDER_CD='I' then GENDER=3; run; %macro REPORTYEAR(START,STOP) ; %do ENTYR = &START %to &STOP ; /*restrict entry cohort years and entries age 0-20 years, ethnic and gender not missing*/ data temp3; set temp1a; where (FIRST_YR = &ENTYR) and age between 0 and 20 AND race in (1,2,3,4,5) and GENDER ne .; AGEGRP=.; if age in (0) then AGEGRP=1; else if age in (1,2) then AGEGRP=2; else if age in (3,4,5) then AGEGRP=3; else if age in (6,7,8,9,10) then AGEGRP=4; else if age in (11,12,13,14,15) then AGEGRP=5; else if age in (16,17) then AGEGRP=6; else if age in (18,19,20) then AGEGRP=7; COUNTY=rsp_cnty*1; AGEGRP2=AGEGRP; if agegrp in (1) then do; if age2 lt 29 then AGEGRP2=1; else AGEGRP2=1.5; end; run; /*remove missing placement type*/ data temp3a; set temp3; if AGEGRP2=. then AGEGRP2=99; if COUNTY in (59,98,99,.) then COUNTY=98; run; /* state */ proc sort data = temp3a; by AGEGRP2; run; /*quartiles*/ ods output quartiles=mlos1; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by AGEGRP2; run; data mlos1; set mlos1; where AGEGRP2 ne .; run; ods output quartiles=mlos1a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); run; data mlos1a; set mlos1a; AGEGRP2=100; run; data mlosfac1; set mlos1 mlos1a ; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; run; proc sort data=temp3a; by county AGEGRP2; run; ods output quartiles=mlos2; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county AGEGRP2; run; data mlos2; set mlos2; where AGEGRP2 ne 7; /*drop missing AGEGRP group*/ drop stratum; run; ods output quartiles=mlos2a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county; run; data mlos2a; set mlos2a; AGEGRP2=100; run; data mlosfac2; set mlos2 mlos2a; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; cal=1; run; data mlosfac3; set mlosfac1 mlosfac2; if county=. Then county=0; else if county in (59,98,99,.) then county = 98; run; /*change values of missing point estimates such that proc format [sfmt] will assign a "**" while misstext in tabulate will assign a blank -- to differentiate between a non-calculable estimate and one where there is no underlying data*/ data mlos&ENTYR; set mlosfac3; if pe1=. then pe1=0; if pe2=. then pe2=0; if pe3=. then pe3=0; PERIOD_DT = &ENTYR; TYPE = 3; /* AGE 0-20 */ GROUP = 2; /* AGE */ rename AGEGRP2 = AGE20A GENDER = GENDER_CD race = ETHNIC; run; proc append base = local.mlos_AGE20 data = mlos&ENTYR; %end; %mend REPORTYEAR ; %REPORTYEAR(2004,2023); /* LOS_ENTRY_YR_AGE_ageout.sas */ /* Purpose: Use Event history analysis to compute median length of stay * by AGE group [CW spell=1 only]. * Original Programmer: Daniel Webster * REVSION HISTORY: * 9-14-2009-created to provide yearly cohort los estimates by age * 4-12-2010-began running data for 2007 entry cohort * 10-14-2010-divided infant category into neonates (<1mo) and others (1-11mo) * 4-20-2011-added 2008 entry cohorts * 2-10-2011-added 2009 entry cohorts * 5-22-2012-modified filename to specify 0-17yr old entries to * accommodate new AB12 programs & files that will reference 0-20yr old entries * 8-29-2012-created new pgm & modified output files to specify 0-17yr old * entries with ageout exit created if still in care at 18th birthday [AB12] * 2-19-2013-added 2010 entry cohorts * 2-14-2014-added 2011 entry cohorts * Project: CWS/CMS Performance Indicators */ data tmp0; set dwh.ucb_fc_afcars; if A34_SPELL = 1 then SP = 1; else if A34_SPELL ge 2 then SP = 2; run; data tmp1; set tmp0; where SP = 1; timein=.; if pe_e_dt = . then do; timein=&CUTOFF -pe_s_dt; end; if pe_e_dt ne . then do; timein=pe_e_dt-pe_s_dt; end; run; /*restrict to children in care 8+ days*/ data tmp1; set tmp1; where timein ge 8; run; /*restrict to one record per child*/ data temp1a; set tmp1; by FKCLIENT_T; if last.FKCLIENT_T; run; /*calculate date of 18th birth date*/ data temp1a; set temp1a; bdate18=intnx('month',birth_dt,12*18,'same'); format bdate18 mmddyy10.; run; /*insert study date where pe end date missing so can*/ /*calculate whether this falls prior to 18th birth date*/ data temp1b; set temp1a; if pe_e_dt=. then pe_e_dt2=&cutoff; else pe_e_dt2=pe_e_dt; run; /*where pe end date falls prior to 18th birth date for*/ /*children still in care, change pe end date to 18th birth date*/ data temp1b; set temp1b; pe_e_dt3=pe_e_dt2; if pe_e_dt2 gt bdate18 then do; pe_e_dt3=bdate18; end; format pe_e_dt2 mmddyy.; format pe_e_dt3 mmddyy.; run; /*proc print data=temp1b (obs=1000); var fkclient_t pe_s_dt pe_e_dt pe_e_dt2 pe_e_dt3 birth_dt bdate18 ; run;*/ data temp1c; set temp1b; drop pe_e_dt pe_e_dt2; run; data temp1c; set temp1c; rename pe_e_dt3=pe_e_dt; run; data temp1a; set temp1c; /* lagdays */ lagdays = .; if (PE_E_DT = .) then do; lagdays = int(&CUTOFF-PE_S_DT); end; if (PE_E_DT ge '01jan88'd) then do; lagdays = int(PE_E_DT-PE_S_DT); end; /* in */ in = .; if (PE_E_DT = .) then in = 1; else if (PE_E_DT ne . and PE_E_DT ge '01jan88'd) then in = 0; first_yr=year(pe_s_dt); /*updated age calculation*/ age = floor((intck('month',birth_dt,pe_s_dt)-(day(pe_s_dt) lt day(birth_dt)))/12); age2 = (pe_s_dt-birth_dt); race=ethnic*1; GENDER=.; if GENDER_CD='F' then GENDER=1; else if GENDER_CD='M' then GENDER=2; else if GENDER_CD='I' then GENDER=3; run; %macro REPORTYEAR(START,STOP) ; %do ENTYR = &START %to &STOP ; /*restrict entry cohort years and entries age 0-17 years, ethnic and gender not missing*/ data temp3; set temp1a; where (FIRST_YR = &ENTYR) and age between 0 and 17 AND race in (1,2,3,4,5) and GENDER ne .; AGEGRP=.; if age in (0) then AGEGRP=1; else if age in (1,2) then AGEGRP=2; else if age in (3,4,5) then AGEGRP=3; else if age in (6,7,8,9,10) then AGEGRP=4; else if age in (11,12,13,14,15) then AGEGRP=5; else if age in (16,17) then AGEGRP=6; COUNTY=rsp_cnty*1; AGEGRP2=AGEGRP; if agegrp in (1) then do; if age2 lt 29 then AGEGRP2=1; else AGEGRP2=1.5; end; run; /*remove missing placement type*/ data temp3a; set temp3; if AGEGRP2=. then AGEGRP2=99; if COUNTY in (59,98,99,.) then COUNTY=98; run; /* state */ proc sort data = temp3a; by AGEGRP2; run; /*quartiles*/ ods output quartiles=mlos1; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by AGEGRP2; run; data mlos1; set mlos1; where AGEGRP2 ne .; run; ods output quartiles=mlos1a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); run; data mlos1a; set mlos1a; AGEGRP2=100; run; data mlosfac1; set mlos1 mlos1a ; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; run; proc sort data=temp3a; by county AGEGRP2; run; ods output quartiles=mlos2; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county AGEGRP2; run; data mlos2; set mlos2; where AGEGRP2 ne 7; /*drop missing AGEGRP group*/ drop stratum; run; ods output quartiles=mlos2a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county; run; data mlos2a; set mlos2a; AGEGRP2=100; run; data mlosfac2; set mlos2 mlos2a; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; cal=1; run; data mlosfac3; set mlosfac1 mlosfac2; if county=. Then county=0; else if county in (59,98,99,.) then county = 98; run; /*change values of missing point estimates such that proc format [sfmt] will assign a "**" while misstext in tabulate will assign a blank -- to differentiate between a non-calculable estimate and one where there is no underlying data*/ data mlos&ENTYR; set mlosfac3; if pe1=. then pe1=0; if pe2=. then pe2=0; if pe3=. then pe3=0; PERIOD_DT = &ENTYR; TYPE = 2; /* AGE 0-17 Aged Out */ GROUP = 2; /* AGE */ rename AGEGRP2 = AGE17OUT GENDER = GENDER_CD race = ETHNIC; run; proc append base = local.mlos_AGE17OUT data = mlos&ENTYR; run; %end; %mend REPORTYEAR ; %REPORTYEAR(2004,2023); /* LOS_ENTRY_YR_ETH_0-17yr.sas */ /* Purpose: Use Event history analysis to compute median length of stay * by ETHNIC group [CW spell=1 only]. * Original Programmer: Daniel Webster * REVSION HISTORY: * 9-14-2009-created to provide yearly cohort los estimates by ethnicity * 4-12-2010-added 2007 entry cohorts * 4-20-2011-added 2008 entry cohorts * 2-10-2011-added 2009 entry cohorts * 5-22-2012-modified filename to specify 0-17yr old entries to * accommodate new AB12 programs & files that will reference 0-20yr old entries * 2-19-2013-added 2010 entry cohorts * 2-14-2014-added 2011 entry cohorts * Project: CWS/CMS Performance Indicators */ data tmp0; set dwh.ucb_fc_afcars; if A34_SPELL = 1 then SP = 1; else if A34_SPELL ge 2 then SP = 2; run; data tmp1; set tmp0; where SP = 1; timein=.; if pe_e_dt = . then do; timein=&CUTOFF-pe_s_dt; end; if pe_e_dt ne . then do; timein=pe_e_dt-pe_s_dt; end; run; /*restrict to children in care 8+ days*/ data tmp1; set tmp1; where timein ge 8; run; /*restrict to one record per child*/ data temp1a; set tmp1; by FKCLIENT_T; if last.FKCLIENT_T; /* lagdays */ lagdays = .; if (PE_E_DT = .) then do; lagdays = int("&CUTOFF"d-PE_S_DT); end; if (PE_E_DT ge '01jan88'd) then do; lagdays = int(PE_E_DT-PE_S_DT); end; /* in */ in = .; if (PE_E_DT = .) then in = 1; else if (PE_E_DT ne . and PE_E_DT ge '01jan88'd) then in = 0; first_yr=year(pe_s_dt); /*updated age calculation*/ age = floor((intck('month',birth_dt,pe_s_dt)-(day(pe_s_dt) lt day(birth_dt)))/12); race=ethnic*1; GENDER=.; if GENDER_CD='F' then GENDER=1; else if GENDER_CD='M' then GENDER=2; else if GENDER_CD='I' then GENDER=3; run; %macro REPORTYEAR(START,STOP) ; %do ENTYR = &START %to &STOP ; /*restrict entry cohort years and entries age 0-17 years, ethnic and gender not missing*/ data temp3; set temp1a; where (FIRST_YR = &ENTYR) and age between 0 and 17 AND race in (1,2,3,4,5) and GENDER ne .; COUNTY=rsp_cnty*1; run; /*remove missing placement type*/ data temp3a; set temp3; if COUNTY in (59,98,99,.) then COUNTY=98; run; /* state */ proc sort data = temp3a; by RACE; run; /*quartiles*/ ods output quartiles=mlos1; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by RACE; run; data mlos1; set mlos1; where RACE ne .; run; ods output quartiles=mlos1a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); run; data mlos1a; set mlos1a; RACE=100; run; data mlosfac1; set mlos1 mlos1a ; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; run; proc sort data=temp3a; by county RACE; run; ods output quartiles=mlos2; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county RACE; run; data mlos2; set mlos2; where RACE ne .; /*drop missing RACE group*/ drop stratum; run; ods output quartiles=mlos2a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county; run; data mlos2a; set mlos2a; RACE=100; run; data mlosfac2; set mlos2 mlos2a; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; cal=1; run; data mlosfac3; set mlosfac1 mlosfac2; if county=. Then county=0; else if county in (59,98,99,.) then county = 98; run; /*change values of missing point estimates such that proc format [sfmt] will assign a "**" while misstext in tabulate will assign a blank -- to differentiate between a non-calculable estimate and one where there is no underlying data*/ data mlos&ENTYR; set mlosfac3; if pe1=. then pe1=0; if pe2=. then pe2=0; if pe3=. then pe3=0; PERIOD_DT = &ENTYR; TYPE = 1; /* AGE 0-17 */ GROUP = 3; /* Ethnicity */ rename GENDER = GENDER_CD race = ETHNIC; run; proc append base = local.mlos_ETH17 data = mlos&ENTYR; run; %end; %mend REPORTYEAR ; %REPORTYEAR(2004,2023); /* LOS_ENTRY_YR_ETH_0-20yr.sas */ /* Purpose: Use Event history analysis to compute median length of stay * by ETHNIC group [CW spell=1 only]. * Original Programmer: Daniel Webster * REVSION HISTORY: * 9-14-2009-created to provide yearly cohort los estimates by ethnicity * 4-12-2010-added 2007 entry cohorts * 4-20-2011-added 2008 entry cohorts * 2-10-2011-added 2009 entry cohorts * 5-22-2012-modified filename to specify 0-20yr old entries to * accommodate new AB12 programs & files that will reference 0-20yr old entries * 2-19-2013-added 2010 entry cohorts * 2-14-2014-added 2011 entry cohorts * Project: CWS/CMS Performance Indicators */ data tmp0; set dwh.ucb_fc_afcars; if A34_SPELL = 1 then SP = 1; else if A34_SPELL ge 2 then SP = 2; run; data tmp1; set tmp0; where SP = 1; timein=.; if pe_e_dt = . then do; timein=&CUTOFF-pe_s_dt; end; if pe_e_dt ne . then do; timein=pe_e_dt-pe_s_dt; end; run; /*restrict to children in care 8+ days*/ data tmp1; set tmp1; where timein ge 8; run; /*restrict to one record per child*/ data temp1a; set tmp1; by FKCLIENT_T; if last.FKCLIENT_T; /* lagdays */ lagdays = .; if (PE_E_DT = .) then do; lagdays = int("&CUTOFF"d-PE_S_DT); end; if (PE_E_DT ge '01jan88'd) then do; lagdays = int(PE_E_DT-PE_S_DT); end; /* in */ in = .; if (PE_E_DT = .) then in = 1; else if (PE_E_DT ne . and PE_E_DT ge '01jan88'd) then in = 0; first_yr=year(pe_s_dt); /*updated age calculation*/ age = floor((intck('month',birth_dt,pe_s_dt)-(day(pe_s_dt) lt day(birth_dt)))/12); race=ethnic*1; GENDER=.; if GENDER_CD='F' then GENDER=1; else if GENDER_CD='M' then GENDER=2; else if GENDER_CD='I' then GENDER=3; run; %macro REPORTYEAR(START,STOP) ; %do ENTYR = &START %to &STOP ; /*restrict entry cohort years and entries age 0-20 years, ethnic and gender not missing*/ data temp3; set temp1a; where (FIRST_YR = &ENTYR) and age between 0 and 20 AND race in (1,2,3,4,5) and GENDER ne .; COUNTY=rsp_cnty*1; run; /*remove missing placement type*/ data temp3a; set temp3; if COUNTY in (59,98,99,.) then COUNTY=98; run; /* state */ proc sort data = temp3a; by RACE; run; /*quartiles*/ ods output quartiles=mlos1; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by RACE; run; data mlos1; set mlos1; where RACE ne .; run; ods output quartiles=mlos1a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); run; data mlos1a; set mlos1a; RACE=100; run; data mlosfac1; set mlos1 mlos1a ; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; run; proc sort data=temp3a; by county RACE; run; ods output quartiles=mlos2; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county RACE; run; data mlos2; set mlos2; where RACE ne .; /*drop missing RACE group*/ drop stratum; run; ods output quartiles=mlos2a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county; run; data mlos2a; set mlos2a; RACE=100; run; data mlosfac2; set mlos2 mlos2a; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; cal=1; run; data mlosfac3; set mlosfac1 mlosfac2; if county=. Then county=0; else if county in (59,98,99,.) then county = 98; run; /*change values of missing point estimates such that proc format [sfmt] will assign a "**" while misstext in tabulate will assign a blank -- to differentiate between a non-calculable estimate and one where there is no underlying data*/ data mlos&ENTYR; set mlosfac3; if pe1=. then pe1=0; if pe2=. then pe2=0; if pe3=. then pe3=0; PERIOD_DT = &ENTYR; TYPE = 3; /* AGE 0-20 */ GROUP = 3; /* Ethnicity */ rename GENDER = GENDER_CD race = ETHNIC; run; proc append base = local.mlos_ETHNIC20 data = mlos&ENTYR; %end; %mend REPORTYEAR ; %REPORTYEAR(2004,2023); /* LOS_ENTRY_YR_ETHNIC_ageout.sas */ /* Purpose: Use Event history analysis to compute median length of stay * by ETHNIC group [CW spell=1 only]. * Original Programmer: Daniel Webster * REVSION HISTORY: * 9-14-2009-created to provide yearly cohort los estimates by ethnicity * 4-12-2010-added 2007 entry cohorts * 4-20-2011-added 2008 entry cohorts * 2-10-2011-added 2009 entry cohorts * 5-22-2012-modified filename to specify 0-17yr old entries to * accommodate new AB12 programs & files that will reference 0-20yr old entries * 8-29-2012-created new pgm & modified output files to specify 0-17yr old * entries with ageout exit created if still in care at 18th birthday [AB12] * 2-19-2013-added 2010 entry cohorts * 2-14-2014-added 2011 entry cohorts * Project: CWS/CMS Performance Indicators */ data tmp0; set dwh.ucb_fc_afcars; if A34_SPELL = 1 then SP = 1; else if A34_SPELL ge 2 then SP = 2; run; data tmp1; set tmp0; where SP = 1; timein=.; if pe_e_dt = . then do; timein=&CUTOFF-pe_s_dt; end; if pe_e_dt ne . then do; timein=pe_e_dt-pe_s_dt; end; run; /*restrict to children in care 8+ days*/ data tmp1; set tmp1; where timein ge 8; run; /*restrict to one record per child*/ data temp1a; set tmp1; by FKCLIENT_T; if last.FKCLIENT_T; run; /*calculate date of 18th birth date*/ data temp1a; set temp1a; bdate18=intnx('month',birth_dt,12*18,'same'); format bdate18 mmddyy10.; run; /*insert study date where pe end date missing so can*/ /*calculate whether this falls prior to 18th birth date*/ data temp1b; set temp1a; if pe_e_dt=. then pe_e_dt2=&cutoff; else pe_e_dt2=pe_e_dt; run; /*where pe end date falls prior to 18th birth date for*/ /*children still in care, change pe end date to 18th birth date*/ data temp1b; set temp1b; pe_e_dt3=pe_e_dt2; if pe_e_dt2 gt bdate18 then do; pe_e_dt3=bdate18; end; format pe_e_dt2 mmddyy.; format pe_e_dt3 mmddyy.; run; /*proc print data=temp1b (obs=1000); var fkclient_t pe_s_dt pe_e_dt pe_e_dt2 pe_e_dt3 birth_dt bdate18 ; run;*/ data temp1c; set temp1b; drop pe_e_dt pe_e_dt2; run; data temp1c; set temp1c; rename pe_e_dt3=pe_e_dt; run; data temp1a; set temp1c; /* lagdays */ lagdays = .; if (PE_E_DT = .) then do; lagdays = int("&CUTOFF"d-PE_S_DT); end; if (PE_E_DT ge '01jan88'd) then do; lagdays = int(PE_E_DT-PE_S_DT); end; /* in */ in = .; if (PE_E_DT = .) then in = 1; else if (PE_E_DT ne . and PE_E_DT ge '01jan88'd) then in = 0; first_yr=year(pe_s_dt); /*updated age calculation*/ age = floor((intck('month',birth_dt,pe_s_dt)-(day(pe_s_dt) lt day(birth_dt)))/12); race=ethnic*1; GENDER=.; if GENDER_CD='F' then GENDER=1; else if GENDER_CD='M' then GENDER=2; else if GENDER_CD='I' then GENDER=3; run; %macro REPORTYEAR(START,STOP) ; %do ENTYR = &START %to &STOP ; /*restrict entry cohort years and entries age 0-17 years, ethnic and gender not missing*/ data temp3; set temp1a; where (FIRST_YR = &ENTYR) and age between 0 and 17 AND race in (1,2,3,4,5) and GENDER ne .; COUNTY=rsp_cnty*1; run; /*remove missing placement type*/ data temp3a; set temp3; if COUNTY in (59,98,99,.) then COUNTY=98; run; /* state */ proc sort data = temp3a; by RACE; run; /*quartiles*/ ods output quartiles=mlos1; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by RACE; run; data mlos1; set mlos1; where RACE ne .; run; ods output quartiles=mlos1a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); run; data mlos1a; set mlos1a; RACE=100; run; data mlosfac1; set mlos1 mlos1a ; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; run; proc sort data=temp3a; by county RACE; run; ods output quartiles=mlos2; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county RACE; run; data mlos2; set mlos2; where RACE ne .; /*drop missing RACE group*/ drop stratum; run; ods output quartiles=mlos2a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county; run; data mlos2a; set mlos2a; RACE=100; run; data mlosfac2; set mlos2 mlos2a; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; cal=1; run; data mlosfac3; set mlosfac1 mlosfac2; if county=. Then county=0; else if county in (59,98,99,.) then county = 98; run; /*change values of missing point estimates such that proc format [sfmt] will assign a "**" while misstext in tabulate will assign a blank -- to differentiate between a non-calculable estimate and one where there is no underlying data*/ data mlos&ENTYR; set mlosfac3; if pe1=. then pe1=0; if pe2=. then pe2=0; if pe3=. then pe3=0; PERIOD_DT = &ENTYR; TYPE = 2; /* AGE 0-17 Aged Out */ GROUP = 3; /* Ethnicity */ rename GENDER = GENDER_CD race = ETHNIC; run; proc append base = local.mlos_ETH17OUT data = mlos&ENTYR; run; %end; %mend REPORTYEAR ; %REPORTYEAR(2004,2023); /* LOS_ENTRY_YR_GENDER_0-17yr.sas */ /* Purpose: Use Event history analysis to compute median length of stay * by GENDER group [CW spell=1 only]. * Original Programmer: Daniel Webster * REVSION HISTORY: * 9-14-2009-created to provide yearly cohort los estimates by GENDER * 4-12-2010-added 2007 entry cohorts * 4-20-2011-added 2008 entry cohorts * 2-10-2011-added 2009 entry cohorts * 5-22-2012-modified filename to specify 0-17yr old entries to * accommodate new AB12 programs & files that will reference 0-20yr old entries * 2-19-2013-added 2010 entry cohorts * 2-14-2014-added 2011 entry cohorts * Project: CWS/CMS Performance Indicators */ data tmp0; set dwh.ucb_fc_afcars; if A34_SPELL = 1 then SP = 1; else if A34_SPELL ge 2 then SP = 2; run; data tmp1; set tmp0; where SP = 1; timein=.; if pe_e_dt = . then do; timein=&CUTOFF-pe_s_dt; end; if pe_e_dt ne . then do; timein=pe_e_dt-pe_s_dt; end; run; /*restrict to children in care 8+ days*/ data tmp1; set tmp1; where timein ge 8; run; /*restrict to one record per child*/ data temp1a; set tmp1; by FKCLIENT_T; if last.FKCLIENT_T; /* lagdays */ lagdays = .; if (PE_E_DT = .) then do; lagdays = int("&CUTOFF"d-PE_S_DT); end; if (PE_E_DT ge '01jan88'd) then do; lagdays = int(PE_E_DT-PE_S_DT); end; /* in */ in = .; if (PE_E_DT = .) then in = 1; else if (PE_E_DT ne . and PE_E_DT ge '01jan88'd) then in = 0; first_yr=year(pe_s_dt); /*updated age calculation*/ age = floor((intck('month',birth_dt,pe_s_dt)-(day(pe_s_dt) lt day(birth_dt)))/12); race=ethnic*1; GENDER=.; if GENDER_CD='F' then GENDER=1; else if GENDER_CD='M' then GENDER=2; else if GENDER_CD='I' then GENDER=3; run; %macro REPORTYEAR(START,STOP) ; %do ENTYR = &START %to &STOP ; /*restrict entry cohort years and entries age 0-17 years, ethnic and gender not missing*/ data temp3; set temp1a; where (FIRST_YR = &ENTYR) and age between 0 and 17 AND race in (1,2,3,4,5) and GENDER ne .; COUNTY=rsp_cnty*1; run; /*remove missing placement type*/ data temp3a; set temp3; if COUNTY in (59,98,99,.) then COUNTY=98; run; /* state */ proc sort data = temp3a; by GENDER; run; /*quartiles*/ ods output quartiles=mlos1; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by GENDER; run; data mlos1; set mlos1; where GENDER ne .; run; ods output quartiles=mlos1a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); run; data mlos1a; set mlos1a; GENDER=100; run; data mlosfac1; set mlos1 mlos1a ; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; run; proc sort data=temp3a; by county GENDER; run; ods output quartiles=mlos2; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county GENDER; run; data mlos2; set mlos2; where GENDER ne .; /*drop missing GENDER group*/ drop stratum; run; ods output quartiles=mlos2a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county; run; data mlos2a; set mlos2a; GENDER=100; run; data mlosfac2; set mlos2 mlos2a; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; cal=1; run; data mlosfac3; set mlosfac1 mlosfac2; if county=. Then county=0; else if county in (59,98,99,.) then county = 98; run; /*change values of missing point estimates such that proc format [sfmt] will assign a "**" while misstext in tabulate will assign a blank -- to differentiate between a non-calculable estimate and one where there is no underlying data*/ data mlos&ENTYR; set mlosfac3; if pe1=. then pe1=0; if pe2=. then pe2=0; if pe3=. then pe3=0; PERIOD_DT = &ENTYR; TYPE = 1; /* AGE 0-17 */ GROUP = 4; /* Gender */ rename GENDER = GENDER_CD race = ETHNIC; run; proc append base = local.mlos_GEN17 data = mlos&ENTYR; run; %end; %mend REPORTYEAR ; %REPORTYEAR(2004,2023); /* LOS_ENTRY_YR_GENDER_0-20yr.sas */ /* Purpose: Use Event history analysis to compute median length of stay * by GENDER group [CW spell=1 only]. * Original Programmer: Daniel Webster * REVSION HISTORY: * 9-14-2009-created to provide yearly cohort los estimates by GENDER * 4-12-2010-added 2007 entry cohorts * 4-20-2011-added 2008 entry cohorts * 2-10-2011-added 2009 entry cohorts * 5-22-2012-modified filename to specify 0-20yr old entries to * accommodate new AB12 programs & files that will reference 0-20yr old entries * 2-19-2013-added 2010 entry cohorts * 2-14-2014-added 2011 entry cohorts * Project: CWS/CMS Performance Indicators */ data tmp0; set dwh.ucb_fc_afcars; if A34_SPELL = 1 then SP = 1; else if A34_SPELL ge 2 then SP = 2; run; data tmp1; set tmp0; where SP = 1; timein=.; if pe_e_dt = . then do; timein=&CUTOFF-pe_s_dt; end; if pe_e_dt ne . then do; timein=pe_e_dt-pe_s_dt; end; run; /*restrict to children in care 8+ days*/ data tmp1; set tmp1; where timein ge 8; run; /*restrict to one record per child*/ data temp1a; set tmp1; by FKCLIENT_T; if last.FKCLIENT_T; /* lagdays */ lagdays = .; if (PE_E_DT = .) then do; lagdays = int("&CUTOFF"d-PE_S_DT); end; if (PE_E_DT ge '01jan88'd) then do; lagdays = int(PE_E_DT-PE_S_DT); end; /* in */ in = .; if (PE_E_DT = .) then in = 1; else if (PE_E_DT ne . and PE_E_DT ge '01jan88'd) then in = 0; first_yr=year(pe_s_dt); /*updated age calculation*/ age = floor((intck('month',birth_dt,pe_s_dt)-(day(pe_s_dt) lt day(birth_dt)))/12); race=ethnic*1; GENDER=.; if GENDER_CD='F' then GENDER=1; else if GENDER_CD='M' then GENDER=2; else if GENDER_CD='I' then GENDER=3; run; %macro REPORTYEAR(START,STOP) ; %do ENTYR = &START %to &STOP ; /*restrict entry cohort years and entries age 0-20 years, ethnic and gender not missing*/ data temp3; set temp1a; where (FIRST_YR = &ENTYR) and age between 0 and 20 AND race in (1,2,3,4,5) and GENDER ne .; COUNTY=rsp_cnty*1; run; /*remove missing placement type*/ data temp3a; set temp3; if COUNTY in (59,98,99,.) then COUNTY=98; run; /* state */ proc sort data = temp3a; by GENDER; run; /*quartiles*/ ods output quartiles=mlos1; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by GENDER; run; data mlos1; set mlos1; where GENDER ne .; run; ods output quartiles=mlos1a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); run; data mlos1a; set mlos1a; GENDER=100; run; data mlosfac1; set mlos1 mlos1a ; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; run; proc sort data=temp3a; by county GENDER; run; ods output quartiles=mlos2; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county GENDER; run; data mlos2; set mlos2; where GENDER ne .; /*drop missing GENDER group*/ drop stratum; run; ods output quartiles=mlos2a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county; run; data mlos2a; set mlos2a; GENDER=100; run; data mlosfac2; set mlos2 mlos2a; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; cal=1; run; data mlosfac3; set mlosfac1 mlosfac2; if county=. Then county=0; else if county in (59,98,99,.) then county = 98; run; /*change values of missing point estimates such that proc format [sfmt] will assign a "**" while misstext in tabulate will assign a blank -- to differentiate between a non-calculable estimate and one where there is no underlying data*/ data mlos&ENTYR; set mlosfac3; if pe1=. then pe1=0; if pe2=. then pe2=0; if pe3=. then pe3=0; PERIOD_DT = &ENTYR; TYPE = 3; /* AGE 0-20 */ GROUP = 4; /* Gender */ rename GENDER = GENDER_CD race = ETHNIC; run; proc append base = local.mlos_GEN20 data = mlos&ENTYR; %end; %mend REPORTYEAR ; %REPORTYEAR(2004,2023); /* LOS_ENTRY_YR_GENDER_ageout.sas */ /* Purpose: Use Event history analysis to compute median length of stay * by GENDER group [CW spell=1 only]. * Original Programmer: Daniel Webster * REVSION HISTORY: * 9-14-2009-created to provide yearly cohort los estimates by GENDER * 4-12-2010-added 2007 entry cohorts * 4-20-2011-added 2008 entry cohorts * 2-10-2011-added 2009 entry cohorts * 5-22-2012-modified filename to specify 0-17yr old entries to * accommodate new AB12 programs & files that will reference 0-20yr old entries * 8-29-2012-created new pgm & modified output files to specify 0-17yr old * entries with ageout exit created if still in care at 18th birthday [AB12] * 2-19-2013-added 2010 entry cohorts * 2-14-2014-added 2011 entry cohorts * Project: CWS/CMS Performance Indicators */ data tmp0; set dwh.ucb_fc_afcars; if A34_SPELL = 1 then SP = 1; else if A34_SPELL ge 2 then SP = 2; run; data tmp1; set tmp0; where SP = 1; timein=.; if pe_e_dt = . then do; timein=&CUTOFF-pe_s_dt; end; if pe_e_dt ne . then do; timein=pe_e_dt-pe_s_dt; end; run; /*restrict to children in care 8+ days*/ data tmp1; set tmp1; where timein ge 8; run; /*restrict to one record per child*/ data temp1a; set tmp1; by FKCLIENT_T; if last.FKCLIENT_T; run; /*calculate date of 18th birth date*/ data temp1a; set temp1a; bdate18=intnx('month',birth_dt,12*18,'same'); format bdate18 mmddyy10.; run; /*insert study date where pe end date missing so can*/ /*calculate whether this falls prior to 18th birth date*/ data temp1b; set temp1a; if pe_e_dt=. then pe_e_dt2=&cutoff; else pe_e_dt2=pe_e_dt; run; /*where pe end date falls prior to 18th birth date for*/ /*children still in care, change pe end date to 18th birth date*/ data temp1b; set temp1b; pe_e_dt3=pe_e_dt2; if pe_e_dt2 gt bdate18 then do; pe_e_dt3=bdate18; end; format pe_e_dt2 mmddyy.; format pe_e_dt3 mmddyy.; run; /*proc print data=temp1b (obs=1000); var fkclient_t pe_s_dt pe_e_dt pe_e_dt2 pe_e_dt3 birth_dt bdate18 ; run;*/ data temp1c; set temp1b; drop pe_e_dt pe_e_dt2; run; data temp1c; set temp1c; rename pe_e_dt3=pe_e_dt; run; data temp1a; set temp1c; /* lagdays */ lagdays = .; if (PE_E_DT = .) then do; lagdays = int("&CUTOFF"d-PE_S_DT); end; if (PE_E_DT ge '01jan88'd) then do; lagdays = int(PE_E_DT-PE_S_DT); end; /* in */ in = .; if (PE_E_DT = .) then in = 1; else if (PE_E_DT ne . and PE_E_DT ge '01jan88'd) then in = 0; first_yr=year(pe_s_dt); /*updated age calculation*/ age = floor((intck('month',birth_dt,pe_s_dt)-(day(pe_s_dt) lt day(birth_dt)))/12); race=ethnic*1; GENDER=.; if GENDER_CD='F' then GENDER=1; else if GENDER_CD='M' then GENDER=2; else if GENDER_CD='I' then GENDER=3; run; %macro REPORTYEAR(START,STOP) ; %do ENTYR = &START %to &STOP ; /*restrict entry cohort years and entries age 0-17 years, ethnic and gender not missing*/ data temp3; set temp1a; where (FIRST_YR = &ENTYR) and age between 0 and 17 AND race in (1,2,3,4,5) and GENDER ne .; COUNTY=rsp_cnty*1; run; /*remove missing placement type*/ data temp3a; set temp3; if COUNTY in (59,98,99,.) then COUNTY=98; run; /* state */ proc sort data = temp3a; by GENDER; run; /*quartiles*/ ods output quartiles=mlos1; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by GENDER; run; data mlos1; set mlos1; where GENDER ne .; run; ods output quartiles=mlos1a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); run; data mlos1a; set mlos1a; GENDER=100; run; data mlosfac1; set mlos1 mlos1a ; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; run; proc sort data=temp3a; by county GENDER; run; ods output quartiles=mlos2; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county GENDER; run; data mlos2; set mlos2; where GENDER ne .; /*drop missing GENDER group*/ drop stratum; run; ods output quartiles=mlos2a; proc lifetest data=temp3a method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county; run; data mlos2a; set mlos2a; GENDER=100; run; data mlosfac2; set mlos2 mlos2a; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; cal=1; run; data mlosfac3; set mlosfac1 mlosfac2; if county=. Then county=0; else if county in (59,98,99,.) then county = 59; run; /*change values of missing point estimates such that proc format [sfmt] will assign a "**" while misstext in tabulate will assign a blank -- to differentiate between a non-calculable estimate and one where there is no underlying data*/ data mlos&ENTYR; set mlosfac3; if pe1=. then pe1=0; if pe2=. then pe2=0; if pe3=. then pe3=0; PERIOD_DT = &ENTYR; TYPE = 2; /* AGE 0-17 Aged Out */ GROUP = 4; /* Gender */ rename GENDER = GENDER_CD race = ETHNIC; run; proc append base = local.mlos_GEN17OUT data = mlos&ENTYR; run; %end; %mend REPORTYEAR ; %REPORTYEAR(2004,2023); /* LOS_ENTRY_YR_PPT_0-17yr.sas */ /* Purpose: Use Event history analysis to compute median length of stay * by entry cohort year [CW spell=1 only] * Programmer: D. Webster * Project: CWS/CMS Performance Indicators * 8-18-2008-change program to call on UCB_AFCARS; examine spells only 8+ days * 8-18-2008-categorize last placement using scp_rltc into only kin & non-kin, * after frequencies on temp3 below showed that, of those with last placement * in congregate care, lt 1% were placed with kin * 1-27-2009-change age calculation * 5-21-2009-added classdata steps to force in rows for all ctys & strata * 4-12-2010-added 2007 entry cohorts * 4-20-2011-added 2008 entry cohorts * 2-10-2011-added 2009 entry cohorts * 5-22-2012-modified filename to specify 0-17yr old entries to * accommodate new AB12 programs & files that will reference 0-20yr old entries * 2-19-2013-added 2010 entry cohorts * 2-14-2014-added 2011 entry cohorts * 12-2-2016-chnage kin & non-kin to predominant placement facility type * Project: CWS/CMS Performance Indicators * 9-27-2021 - mofified for new UCB_FC and to allow missing county j magruder */ libname userstor "/opt/sas8.2/ud_templates" ; ods path userstor.templat(read) sashelp.tmplmst(read) ; data tmp0; set dwh.ucb_fc_afcars; if A34_SPELL = 1 then SP = 1; else if A34_SPELL ge 2 then SP = 2; if PREDOM_FT = 99 then PREDOM_FT = 98; run; data tmp1; set tmp0; where SP = 1; timein=.; if pe_e_dt = . then do; timein=&CUTOFF-pe_s_dt; end; if pe_e_dt ne . then do; timein=pe_e_dt-pe_s_dt; end; run; /*restrict to children in care 8+ days*/ data tmp1; set tmp1; where timein ge 8; run; /*PROC PRINT DATA=TMP1 (obs=200); var fkclient_t spell a34_spell plcmnt plc_last; run;*/ /*get last placement type in spell*/ proc sort data=tmp1; by fkclient_t spell oh_s_dt; data temp1; set tmp1; by fkclient_t; if last.fkclient_t; plc_last=plc_fclc; scp_last=scp_rltc; if plc_last=. then plc_last=0; run; /*set missing placement type to 0*/ /* data temp1; set tmp2; faclast2=.; if faclast in (0) then faclast2=0; else faclast2 = faclast; run; */ /*construct age, ethnic vars*/ data temp1a; set temp1; /* lagdays */ lagdays = .; if (PE_E_DT = .) then do; lagdays = int("&CUTOFF"d-PE_S_DT); end; if (PE_E_DT ge '01jan1988'd) then do; lagdays = int(PE_E_DT-PE_S_DT); end; /* in */ in = .; if (PE_E_DT = .) then in = 1; else if (PE_E_DT ne . and PE_E_DT ge '01jan1988'd) then in = 0; first_yr=year(pe_s_dt); /*updated age calculation*/ age = floor((intck('month',birth_dt,pe_s_dt)-(day(pe_s_dt) lt day(birth_dt)))/12); race=ethnic*1; GENDER=.; if GENDER_CD='F' then GENDER=1; else if GENDER_CD='M' then GENDER=2; else if GENDER_CD='I' then GENDER=3; run; %macro REPORTYEAR(START,STOP) ; %do ENTYR = &START %to &STOP ; /*restrict to entry cohort and entries age 0-17 years*/ data temp3; set temp1a; where (FIRST_YR = &ENTYR) and age between 0 and 17 AND race in (1,2,3,4,5) and GENDER ne .; run; /*run freqs to see what % of last plcmnt=congregate are with kin*/ /*if low % then just code as kin/non-kin with no separate category for congregate--turns out it is lt 1% w. kin*/ /* proc freq data=temp3; tables kincong*kinbin; run; */ /*remove missing placement type*/ data tmp&ENTYR; set temp3; *where PREDOM_FT ne 98; county=rsp_cnty*1; /*modified 2021.09.27*/ run; data tmp&ENTYR; set tmp&ENTYR; if county in (59,98,99,.) then county=98; /*modified to include missing county 2021.09.27*/ run; /* state */ proc sort data = tmp&ENTYR; by PREDOM_FT; run; /*quartiles*/ ods output quartiles=mlos1; proc lifetest data=tmp&ENTYR method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by PREDOM_FT; run; ods output quartiles=mlos1a; proc lifetest data=tmp&ENTYR method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); run; data mlos1a; set mlos1a; PREDOM_FT=100; run; data mlosfac1; set mlos1 mlos1a ; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; run; proc sort data=tmp&ENTYR; by county PREDOM_FT; run; ods output quartiles=mlos2; proc lifetest data=tmp&ENTYR method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county PREDOM_FT; run; ods output quartiles=mlos2a; proc lifetest data=tmp&ENTYR method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county; run; data mlos2a; set mlos2a; PREDOM_FT=100; run; data mlosfac2; set mlos2 mlos2a; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; cal=1; run; data mlosfac3; set mlosfac1 mlosfac2; if county=. Then county=0; run; /*change values of missing point estimates such that proc format [sfmt] will assign a "**" while misstext in tabulate will assign a blank -- to differentiate between a non-calculable estimate and one where there is no underlying data*/ data mlos&ENTYR; set mlosfac3; if pe1=. then pe1=0; if pe2=. then pe2=0; if pe3=. then pe3=0; PERIOD_DT = &ENTYR; TYPE = 1; /* AGE 0-17 */ GROUP = 1; /* Predominant Placement Type */ rename GENDER = GENDER_CD race = ETHNIC; run; proc append base = local.mlos_PPT17 data = mlos&ENTYR; run; %end; %mend REPORTYEAR ; %REPORTYEAR(2004,2023); /* LOS_ENTRY_YR_PPT_0-20yr.sas */ /* Purpose: Use Event history analysis to compute median length of stay * by entry cohort year [CW spell=1 only] * Programmer: D. Webster * Project: CWS/CMS Performance Indicators * 8-18-2008-change program to call on UCB_AFCARS; examine spells only 8+ days * 8-18-2008-categorize last placement using scp_rltc into only kin & non-kin, * after frequencies on temp3 below showed that, of those with last placement * in congregate care, lt 1% were placed with kin * 1-27-2009-change age calculation * 5-21-2009-added classdata steps to force in rows for all ctys & strata * 4-12-2010-added 2007 entry cohorts * 4-20-2011-added 2008 entry cohorts * 2-10-2011-added 2009 entry cohorts * 5-22-2012-modified filename to specify 0-20yr old entries to * accommodate new AB12 programs & files that will reference 0-20yr old entries * 2-19-2013-added 2010 entry cohorts * 2-14-2014-added 2011 entry cohorts * 12-2-2016-chnage kin & non-kin to predominant placement facility type * Project: CWS/CMS Performance Indicators * 9-27-2021 - mofified for new UCB_FC and to allow missing county j magruder */ libname userstor "/opt/sas8.2/ud_templates" ; ods path userstor.templat(read) sashelp.tmplmst(read) ; data tmp0; set dwh.ucb_fc_afcars; if A34_SPELL = 1 then SP = 1; else if A34_SPELL ge 2 then SP = 2; if PREDOM_FT = 99 then PREDOM_FT = 98; run; data tmp1; set tmp0; where SP = 1; timein=.; if pe_e_dt = . then do; timein=&CUTOFF-pe_s_dt; end; if pe_e_dt ne . then do; timein=pe_e_dt-pe_s_dt; end; run; /*restrict to children in care 8+ days*/ data tmp1; set tmp1; where timein ge 8; run; /*PROC PRINT DATA=TMP1 (obs=200); var fkclient_t spell a34_spell plcmnt plc_last; run;*/ /*get last placement type in spell*/ proc sort data=tmp1; by fkclient_t spell oh_s_dt; data temp1; set tmp1; by fkclient_t; if last.fkclient_t; plc_last=plc_fclc; scp_last=scp_rltc; if plc_last=. then plc_last=0; run; /*set missing placement type to 0*/ /* data temp1; set tmp2; faclast2=.; if faclast in (0) then faclast2=0; else faclast2 = faclast; run; */ /*construct age, ethnic vars*/ data temp1a; set temp1; /* lagdays */ lagdays = .; if (PE_E_DT = .) then do; lagdays = int("&CUTOFF"d-PE_S_DT); end; if (PE_E_DT ge '01jan1988'd) then do; lagdays = int(PE_E_DT-PE_S_DT); end; /* in */ in = .; if (PE_E_DT = .) then in = 1; else if (PE_E_DT ne . and PE_E_DT ge '01jan1988'd) then in = 0; first_yr=year(pe_s_dt); /*updated age calculation*/ age = floor((intck('month',birth_dt,pe_s_dt)-(day(pe_s_dt) lt day(birth_dt)))/12); race=ethnic*1; GENDER=.; if GENDER_CD='F' then GENDER=1; else if GENDER_CD='M' then GENDER=2; else if GENDER_CD='I' then GENDER=3; run; %macro REPORTYEAR(START,STOP) ; %do ENTYR = &START %to &STOP ; /*restrict to entry cohort and entries age 0-20 years*/ data temp3; set temp1a; where (FIRST_YR = &ENTYR) and age between 0 and 20 AND race in (1,2,3,4,5) and GENDER ne .; run; /*run freqs to see what % of last plcmnt=congregate are with kin*/ /*if low % then just code as kin/non-kin with no separate category for congregate--turns out it is lt 1% w. kin*/ /* proc freq data=temp3; tables kincong*kinbin; run; */ /*remove missing placement type*/ data tmp&ENTYR; set temp3; *where PREDOM_FT ne 98; county=rsp_cnty*1; /*modified 2021.09.27*/ run; data tmp&ENTYR; set tmp&ENTYR; if county in (59,98,99,.) then county=98; /*modified to include missing county 2021.09.27*/ run; /* state */ proc sort data = tmp&ENTYR; by PREDOM_FT; run; /*quartiles*/ ods output quartiles=mlos1; proc lifetest data=tmp&ENTYR method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by PREDOM_FT; run; ods output quartiles=mlos1a; proc lifetest data=tmp&ENTYR method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); run; data mlos1a; set mlos1a; PREDOM_FT=100; run; data mlosfac1; set mlos1 mlos1a ; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; run; proc sort data=tmp&ENTYR; by county PREDOM_FT; run; ods output quartiles=mlos2; proc lifetest data=tmp&ENTYR method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county PREDOM_FT; run; ods output quartiles=mlos2a; proc lifetest data=tmp&ENTYR method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county; run; data mlos2a; set mlos2a; PREDOM_FT=100; run; data mlosfac2; set mlos2 mlos2a; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; cal=1; run; data mlosfac3; set mlosfac1 mlosfac2; if county=. Then county=0; run; /*change values of missing point estimates such that proc format [sfmt] will assign a "**" while misstext in tabulate will assign a blank -- to differentiate between a non-calculable estimate and one where there is no underlying data*/ data mlos&ENTYR; set mlosfac3; if pe1=. then pe1=0; if pe2=. then pe2=0; if pe3=. then pe3=0; PERIOD_DT = &ENTYR; TYPE = 3; /* AGE 0-20 */ GROUP = 1; /* Predominant Placement Type */ rename GENDER = GENDER_CD race = ETHNIC; run; proc append base = local.mlos_PPT20 data = mlos&ENTYR; run; %end; %mend REPORTYEAR ; %REPORTYEAR(2004,2023); /* LOS_ENTRY_YR_KNK_ageout.sas */ /* Purpose: Use Event history analysis to compute median length of stay * by entry cohort year [CW spell=1 only] * Programmer: D. Webster * Project: CWS/CMS Performance Indicators * 8-18-2008-change program to call on UCB_AFCARS; examine spells only 8+ days * 8-18-2008-categorize last placement using scp_rltc into only kin & non-kin, * after frequencies on temp3 below showed that, of those with last placement * in congregate care, lt 1% were placed with kin * 1-27-2009-change age calculation * 5-21-2009-added classdata steps to force in rows for all ctys & strata * 4-12-2010-added 2007 entry cohorts * 4-20-2011-added 2008 entry cohorts * 2-10-2011-added 2009 entry cohorts * 5-22-2012-modified filename to specify 0-17yr old entries to * accommodate new AB12 programs & files that will reference 0-20yr old entries * 8-29-2012-created new pgm & modified output files to specify 0-17yr old * entries with ageout exit created if still in care at 18th birthday [AB12] * 2-19-2013-added 2010 entry cohorts * 2-14-2014-added 2011 entry cohorts * 12-2-2016-chnage kin & non-kin to predominant placement facility type * Project: CWS/CMS Performance Indicators * 9-27-2021 - mofified for new UCB_FC and to allow missing county j magruder */ libname userstor "/opt/sas8.2/ud_templates" ; ods path userstor.templat(read) sashelp.tmplmst(read) ; data tmp0; set dwh.ucb_fc_afcars; if A34_SPELL = 1 then SP = 1; else if A34_SPELL ge 2 then SP = 2; if PREDOM_FT = 99 then PREDOM_FT = 98; run; data tmp1; set tmp0; where SP = 1; timein=.; if pe_e_dt = . then do; timein=&CUTOFF-pe_s_dt; end; if pe_e_dt ne . then do; timein=pe_e_dt-pe_s_dt; end; run; /*restrict to children in care 8+ days*/ data tmp1; set tmp1; where timein ge 8; run; /*PROC PRINT DATA=TMP1 (obs=200); var fkclient_t spell a34_spell plcmnt plc_last; run;*/ /*get last placement type in spell*/ proc sort data=tmp1; by fkclient_t spell oh_s_dt; data temp1; set tmp1; by fkclient_t; if last.fkclient_t; plc_last=plc_fclc; scp_last=scp_rltc; if plc_last=. then plc_last=0; run; /*calculate date of 18th birth date*/ data temp1a; set temp1; bdate18=intnx('month',birth_dt,12*18,'same'); format bdate18 mmddyy10.; run; /*insert study date where pe end date missing so can*/ /*calculate whether this falls prior to 18th birth date*/ data temp1b; set temp1a; if pe_e_dt=. then pe_e_dt2=&cutoff; else pe_e_dt2=pe_e_dt; run; /*where pe end date falls prior to 18th birth date for*/ /*children still in care, change pe end date to 18th birth date*/ data temp1b; set temp1b; pe_e_dt3=pe_e_dt2; if pe_e_dt2 gt bdate18 then do; pe_e_dt3=bdate18; end; format pe_e_dt2 mmddyy.; format pe_e_dt3 mmddyy.; run; data temp1c; set temp1b; drop pe_e_dt pe_e_dt2; run; data temp2; set temp1c; rename pe_e_dt3=pe_e_dt; run; /*construct age, ethnic vars*/ data temp2a; set temp2; /* lagdays */ lagdays = .; if (PE_E_DT = .) then do; lagdays = int("&CUTOFF"d-PE_S_DT); end; if (PE_E_DT ge '01jan1988'd) then do; lagdays = int(PE_E_DT-PE_S_DT); end; /* in */ in = .; if (PE_E_DT = .) then in = 1; else if (PE_E_DT ne . and PE_E_DT ge '01jan1988'd) then in = 0; first_yr=year(pe_s_dt); /*updated age calculation*/ age = floor((intck('month',birth_dt,pe_s_dt)-(day(pe_s_dt) lt day(birth_dt)))/12); race=ethnic*1; GENDER=.; if GENDER_CD='F' then GENDER=1; else if GENDER_CD='M' then GENDER=2; else if GENDER_CD='I' then GENDER=3; run; %macro REPORTYEAR(START,STOP) ; %do ENTYR = &START %to &STOP ; /*restrict to entry cohort and entries age 0-17 years*/ data temp3; set temp2a; where (FIRST_YR = &ENTYR) and age between 0 and 17 AND race in (1,2,3,4,5) and GENDER ne .; run; /*run freqs to see what % of last plcmnt=congregate are with kin*/ /*if low % then just code as kin/non-kin with no separate category for congregate--turns out it is lt 1% w. kin*/ /* proc freq data=temp3; tables kincong*kinbin; run; */ /*remove missing placement type*/ data tmp&ENTYR; set temp3; *where PREDOM_FT ne 98; county=rsp_cnty*1; /*modified 2021.09.27*/ run; data tmp&ENTYR; set tmp&ENTYR; if county in (59,98,99,.) then county=98; /*modified to include missing county 2021.09.27*/ run; /* state */ proc sort data = tmp&ENTYR; by PREDOM_FT; run; /*quartiles*/ ods output quartiles=mlos1; proc lifetest data=tmp&ENTYR method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by PREDOM_FT; run; ods output quartiles=mlos1a; proc lifetest data=tmp&ENTYR method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); run; data mlos1a; set mlos1a; PREDOM_FT=100; run; data mlosfac1; set mlos1 mlos1a ; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; run; proc sort data=tmp&ENTYR; by county PREDOM_FT; run; ods output quartiles=mlos2; proc lifetest data=tmp&ENTYR method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county PREDOM_FT; run; ods output quartiles=mlos2a; proc lifetest data=tmp&ENTYR method = km intervals = 1.1 to 85.1 by 85; time lagdays*in(1); by county; run; data mlos2a; set mlos2a; PREDOM_FT=100; run; data mlosfac2; set mlos2 mlos2a; if percent=50 then do; pe2=estimate; end; if percent=25 then do; pe1=estimate; end; if percent=75 then do; pe3=estimate; end; drop stratum; drop estimate; drop percent; drop lowerlimit; drop upperlimit; cal=1; run; data mlosfac3; set mlosfac1 mlosfac2; if county=. Then county=0; run; /*change values of missing point estimates such that proc format [sfmt] will assign a "**" while misstext in tabulate will assign a blank -- to differentiate between a non-calculable estimate and one where there is no underlying data*/ data mlos&ENTYR; set mlosfac3; if pe1=. then pe1=0; if pe2=. then pe2=0; if pe3=. then pe3=0; PERIOD_DT = &ENTYR; TYPE = 2; /* AGE 0-17 Aged Out*/ GROUP = 1; /* Predominant Placement Type */ rename GENDER = GENDER_CD race = ETHNIC; run; proc append base = local.mlos_PPT17OUT data = mlos&ENTYR; run; %end; %mend REPORTYEAR ; %REPORTYEAR(2004,2023); data dvlp.mlos; set local.mlos_age17 local.mlos_ppt17 local.mlos_eth17 local.mlos_gen17 local.mlos_age17out local.mlos_ppt17out local.mlos_eth17out local.mlos_gen17out local.mlos_age20 local.mlos_ppt20 local.mlos_ethnic20 local.mlos_gen20; run; proc sql; drop table local.mlos_age17; drop table local.mlos_ppt17; drop table local.mlos_eth17; drop table local.mlos_gen17; drop table local.mlos_age17out; drop table local.mlos_ppt17out; drop table local.mlos_eth17out; drop table local.mlos_gen17out; drop table local.mlos_age20; drop table local.mlos_ppt20; drop table local.mlos_ethnic20; drop table local.mlos_gen20; quit; data test.mlos; set dvlp.mlos; run;