***Incorporating medical marijuana law (MML) information*********;
data mml;
setmml;
***Include an indicator for the 23 states that passed MML by 2013;
ever_pass = 0;
if abbrev in ("AK""AZ""CA""CO""CT"
"DE""HI""IL""ME""MD"
"MA""MI""MN""MT""NV""NH""NJ"
"NM""NY""OR""RI""VT""WA") thenever_pass = 1;
*****law_status1 is a 0-1 indicator of whether the MML has been passed
yet in the particular state in the particular year;
law_status1 = ever_pass;
if abbrev = "MD" and year < 2003then law_status1 = 0;
if abbrev = "MT" and year < 2004then law_status1 = 0;
if abbrev = "VT" and year < 2004then law_status1 = 0;
if abbrev = "RI" and year < 2006then law_status1 = 0;
if abbrev = "NM" and year < 2007then law_status1 = 0;
if abbrev = "MI" and year < 2008then law_status1 = 0;
if abbrev = "NJ" and year < 2010then law_status1 = 0;
if abbrev = "AZ" and year < 2010then law_status1 = 0;
if abbrev = "DE" and year < 2011then law_status1 = 0;
if abbrev = "CT" and year < 2012then law_status1 = 0;
if abbrev = "MA" and year < 2012then law_status1 = 0;
if abbrev = "IL" and year < 2013then law_status1 = 0;
if abbrev = "NH" and year < 2013then law_status1 = 0;
if abbrev = "MN" and year < 2014then law_status1 = 0;
if abbrev = "NY" and year < 2014then law_status1 = 0;
******earlypass is an indicator of whether the state had already passed MML
before the first year of NSDUH observation 2004;
earlypass = 0;
if abbrev in ("CA","OR","WA","AK","ME","CO","NV","HI", "MD")
thenearlypass = 1;
****Here we create the MMLpass variables using the ever_pass, law_status1, and earlypass indicators;
MMLpass = "after";
ifever_pass = 1 and law_status1 = 0thenMMLpass = "before";
ifearlypass = 1thenMMLpass = "after";
ifever_pass = 0 thenMMLpass = "never";
run;
/** Spline for time trend ***/
data mml;
set mml;
yearcont = year - 2003;*calculate year count;
yearsp = max(yearcont-5, 0);*define the spline knot as 2008;
run;
/** Model: Impact of MMLs on Past month marijuana use by age and gender**/
procmixeddata = mml;
class abbrev age MMLpass gender;
model use = age gender MMLpass age*gender age*MMLpass gender*MMLpass
age*gender*MMLpass
/* historical time trend**/
yearcontyearcont*yearcontyearcont*yearcont*yearcontyearsp*yearsp*yearspage*yearcont age*yearcont*yearcont age*yearcont*yearcont*yearcont age*yearsp*yearsp*yearsp
/* state level covariates **/
Unemp_rateMedian_incoMALE_PCT WHITE_PCT PCT10_24 PCT_NoHS
/solutiondfm = bw;
random abbrev / group=age;
lsmeans age*gender*MMLpass/cl;
/* Code for causal contrasts **/
estimate"AGE 12-17, Men: After to Before"
mmlpass1 -10
age*mmlpass1 -10000000
gender*MMLpass10 -1000
age*gender*MMLpass10 -1000000000000000;
estimate"AGE 12-17, Women: After to Before"
mmlpass1 -10
age*mmlpass1 -10000000
gender*MMLpass010 -100
age*gender*MMLpass010 -1 00000000000000;
estimate"AGE 18-25, Men: After to Before"
mmlpass1 -10
age*mmlpass0001 -10000
gender*MMLpass10 -1000
age*gender*MMLpass000000 10 -1000000000;
estimate"AGE 18-25, Women: After to Before"
mmlpass1 -10
age*mmlpass0001 -10000
gender*MMLpass010 -100
age*gender*MMLpass000000010 -1 00000000;
estimate"AGE 26+, Men: After to Before"
mmlpass1 -10
age*mmlpass0000001 -10
gender*MMLpass10 -1000
age*gender*MMLpass000000000000 10 -1000 ;
estimate"AGE 26+, Women: After to Before"
mmlpass1 -10
age*mmlpass0000001 -10
gender*MMLpass010 -100
age*gender*MMLpass000000000000010 -1 00;
run;