clear *this opens a log file to save the full analysis output log using "C:\Users\Owner\Desktop\Papers\MJ_UPPS\analysis.smcl", replace *this opens the data file (if you download the datafile you'll need to change the directory) use "C:\Users\Owner\Desktop\Papers\MJ_UPPS\MJdta2.dta", clear *recodes MJ problems from no = 2 to no = 0 foreach var of varlist macq1-macq50 { recode `var' 2=0 } *labels the race variable lab define race 1 "white" 2 "black" 3 "asian" 4 "native american" 5 "pacific islander" 6 "other" lab val race race *recodes and labels the sex variable recode sex 2=0 lab define sex 1 "Men" 0 "Women" lab val sex sex *tags missing data so it can be excluded egen missnew = rowmiss(macq1-macq50) gen missing = 1 if missnew==50 drop if missing==1 *generates positive & negative affect variables alpha interested excited strong enthusiastic /// proud alert inspired determined attentive /// active, g(posaff) alpha distressed upset guilty scared hostile /// irritable ashamed nervous jittery afraid, /// g(negaff) *Log transforms 6 month MJ use variable which *was highly skewed sum mj6mo, det gen log6mo = ln(mj6mo) sum log6mo, det *displays sample characteristics for the full sample tab sex tab race sum age, det *this imputes missing data for the affect lability scales -sf. *note, there was no missing, however, this is done as a normal *part of measure coding as some measures are reversed scored. *this allows for us to recode items without changing original *items. foreach var of varlist als1-als18 { impute `var' als1-als18, gen(i_`var') gen ri_`var' = round(i_`var') drop i_`var' } *this generates the three als scales and the final *the als total score *cronbachs alpha for the als total score *als score comprised from the three scales egen alsmiss = rowmiss(als1-als18) egen alsad = rowtotal(ri_als1 ri_als3 ri_als5 ri_als6 ri_als7) alpha ri_als1 ri_als3 ri_als5 ri_als6 ri_als7 egen alsde = rowtotal(ri_als2 ri_als10 ri_als12 ri_als13 ri_als15 ri_als16 ri_als17 ri_als18) alpha ri_als2 ri_als10 ri_als12 ri_als13 ri_als15 ri_als16 ri_als17 ri_als18 egen alsang = rowtotal(ri_als4 ri_als8 ri_als9 ri_als11 ri_als14) alpha ri_als4 ri_als8 ri_als9 ri_als11 ri_als14 egen alstot = rowtotal(ri_als1-ri_als18) if alsmiss<9 alpha ri_als1-ri_als18 if alsmiss<9 alpha alsang alsad alsde if missing~=1, g(ALS) std alpha ri_als1-ri_als18, g(alsall) *this imputes missing data for the distress tolerance scale. *note, there was no missing, however, this is done as a normal *part of measure coding as some measures are reversed scored. *this allows for us to recode items without changing original *items. foreach var of varlist dts1-dts15 { impute `var' dts1-dts15, gen(i_`var') gen ri_`var' = round(i_`var') drop i_`var' } * this creates a new item from the dts for reverse scoring gen rev_ri_dts6 = ri_dts6 * this recodes the above item recode rev_ri_dts6 1=5 2=4 4=2 5=1 *computes a missing score for the dts and finally *converts the dts into a standardized score. egen dtsmiss = rowmiss(dts1-dts15) alpha ri_dts1-ri_dts15 if dtsmiss<8, g(dtsall) std * this creates a total score for the dts egen dtstot = rowtotal(ri_dts1-ri_dts5 rev_ri_dts6 /// ri_dts7-ri_dts15) if dtsmiss<8 * gives cronbachs alpha for dts total score alpha ri_dts1-ri_dts5 rev_ri_dts6 /// ri_dts7-ri_dts15 *computes the dts subscales egen dtstol = rowtotal(ri_dts1 ri_dts3 ri_dts5) alpha ri_dts1 ri_dts3 ri_dts5 if missing~=1 egen dtsapp = rowtotal(rev_ri_dts6 ri_dts7 ri_dts9 ri_dts10 ri_dts12 ri_dts12) alpha rev_ri_dts6 ri_dts7 ri_dts9 ri_dts10 ri_dts12 ri_dts12 if missing~=1 egen dtsabs = rowtotal(ri_dts2 ri_dts4 ri_dts15) alpha ri_dts2 ri_dts4 ri_dts15 if missing~=1 egen dtsreg = rowtotal(ri_dts8 ri_dts13 ri_dts14) alpha ri_dts8 ri_dts13 ri_dts14 if missing~=1 *computes a standard score for the dts from the four subscale totals alpha dtstol dtsapp dtsabs dtsreg if missing~=1, g(DTS) std *imputes data for the upps-p. note that there was *no missing data imputed for the current analysis. this *just allows us to use code we have wirtten for recoding *upps-p items. foreach var of varlist upps1-upps20 { impute `var' upps1-upps20, gen(i_`var') gen ri_`var' = round(i_`var') drop i_`var' } foreach var of varlist upps21-upps40 { impute `var' upps21-upps40, gen(i_`var') gen ri_`var' = round(i_`var') drop i_`var' } foreach var of varlist upps41-upps59 { impute `var' upps41-upps59, gen(i_`var') gen ri_`var' = round(i_`var') drop i_`var' } *creates variables for reverse coding. foreach var of varlist ri_upps2 ri_upps7 ri_upps12 ri_upps17 ri_upps22 /// ri_upps29 ri_upps34 ri_upps39 ri_upps44 ri_upps51 ri_upps58 ri_upps9 /// ri_upps47 ri_upps3 ri_upps8 ri_upps13 ri_upps18 ri_upps23 ri_upps26 /// ri_upps31 ri_upps36 ri_upps41 ri_upps46 ri_upps52 ri_upps56 ri_upps5 /// ri_upps10 ri_upps15 ri_upps20 ri_upps25 ri_upps30 ri_upps35 ri_upps40 /// ri_upps45 ri_upps50 ri_upps53 ri_upps55 ri_upps57 ri_upps59 { gen rev_`var' = `var' } *reverse codes the above variables foreach var of varlist rev_ri_upps2- rev_ri_upps59 { recode `var' 1=4 2=3 3=2 4=1 } *generates the subscales of the upps-p egen uppsmiss = rowmiss(upps1-upps59) egen negurgtot = rowtotal(rev_ri_upps2 - rev_ri_upps58 ri_upps54) if uppsmiss<30 alpha rev_ri_upps2-rev_ri_upps58 ri_upps54 egen premedtot = rowtotal(ri_upps1 ri_upps6 ri_upps11 ri_upps16 ri_upps21 /// ri_upps28 ri_upps33 ri_upps38 ri_upps43 ri_upps49 ) if uppsmiss<30 alpha ri_upps1 ri_upps6 ri_upps11 ri_upps16 ri_upps21 /// ri_upps28 ri_upps33 ri_upps38 ri_upps43 ri_upps49 egen persevtot = rowtotal(ri_upps4 rev_ri_upps9 ri_upps14 ri_upps19 ri_upps24 /// ri_upps27 ri_upps32 ri_upps37 ri_upps42 rev_ri_upps47) if uppsmiss<30 alpha ri_upps4 rev_ri_upps9 ri_upps14 ri_upps19 ri_upps24 /// ri_upps27 ri_upps32 ri_upps37 ri_upps42 rev_ri_upps47 egen senseektot = rowtotal( rev_ri_upps3 - rev_ri_upps56) if uppsmiss<30 alpha rev_ri_upps3 - rev_ri_upps56 egen posurgtot = rowtotal( rev_ri_upps5 - rev_ri_upps59) if uppsmiss<30 alpha rev_ri_upps5 - rev_ri_upps59 *creates standardized variables for urgency and effortful control *the effortful control variable was then reversed so that higher values *indicated better effortful control. this uses the full data set so that *we could compare participants who dropped out of the survey to those *who finished. alpha negurgtot posurgtot if missing~=1, g(urgency) std alpha persevtot premedtot if missing~=1, g(rev_effortful) std gen effortful = rev_effortful*-1 *computes the marijuana use variables egen mjint = rowtotal(mjuse1 - mjuse28) gen mjlog = 0 if mjint==0 & missing~=1 replace mjlog = 1 if mjint>0 & mjint~=. & missing~=1 gen mjcnt = mjint if mjlog == 1 *1 person reported the max mj use (28 times/week) *this was reduced to 1 value greater than the next *highest value. replace mjint = 25 if mjint>25 & mjint~=. replace mjcnt = 25 if mjcnt>25 & mjint~=. *The mjuse variable was highly skewed so a log *transformation was performed on this variable *for use only in the mj problems analysis *(i.e., not the mj use analyses which used count data) gen logmj = ln(mjint) *computes MJ problems variable egen MACQ = rowtotal(macq1-macq50) if missing~=1 gen MACQlog = 0 if MACQ==0 & missing~=1 replace MACQlog = 1 if MACQ~=0 & MACQ~=. & missing~=1 gen MACQcnt = MACQ if MACQlog==1 *1 person reported experiencing all 50 mj use problems *this persons value was reduced 1 greater than the next higher value replace MACQcnt = 37 if MACQcnt>37 & MACQcnt~=. replace MACQ = 37 if MACQ>37 & MACQ~=. *centers sensation seeking variable mcenter senseektot urgency drop C_urgency *Computes interactions for the full use model gen URGxDTS = urgency*DTS gen URGxALS = urgency*ALS gen EFFxDTS = effortful*DTS gen EFFxALS = effortful*ALS gen SSxDTS = C_senseektot*DTS gen SSxALS = C_senseektot*ALS *Generates the self-regulation indicators for *the use count model alpha posurg negurg if mjlog==1 & missing~=1, g(urgency1) std alpha persevtot premedtot if mjlog==1 & missing~=1, g(rev_effortful1) std gen effortful1 = rev_effortful1*-1 mcenter senseektot urgency1 drop C_urgency1 alpha dtstol dtsapp dtsabs dtsreg if missing~=1 & mjlog==1, g(DTS1) std alpha alsang alsad alsde if missing~=1 & mjlog==1, g(ALS1) std *Computes interactions for the mj users only gen URGxDTS1 = urgency1*DTS1 gen URGxALS1 = urgency1*ALS1 gen EFFxDTS1 = effortful1*DTS1 gen EFFxALS1 = effortful1*ALS1 gen SSxDTS1 = C_senseektot1*DTS1 gen SSxALS1 = C_senseektot1*ALS1 *Generates the self-regulation indicators for *those who use mj and reported some problems alpha posurg negurg if mjlog==1 & missing~=1 & MACQlog==1, g(urgency2) std alpha persevtot premedtot if mjlog==1 & missing~=1 & MACQlog==1, g(rev_effortful2) std gen effortful2 = rev_effortful2*-1 mcenter senseektot urgency2 drop C_urgency2 alpha dtstol dtsapp dtsabs dtsreg if missing~=1 & mjlog==1 & MACQlog==1, g(DTS2) std alpha alsang alsad alsde if missing~=1 & mjlog==1 & MACQlog==1, g(ALS2) std *Computes interactions for the mj users w/ >0 problems gen URGxDTS2 = urgency2*DTS2 gen URGxALS2 = urgency2*ALS2 gen EFFxDTS2 = effortful2*DTS2 gen EFFxALS2 = effortful2*ALS2 gen SSxDTS2 = C_senseektot2*DTS2 gen SSxALS2 = C_senseektot2*ALS2 logistic mjlog sex age negaff posaff urgency /// effortful C_senseektot DTS ALS /// , vce(robust) ztnb mjcnt sex age negaff posaff urgency1 /// effortful1 C_senseektot1 DTS1 ALS1 /// , vce(robust) irr logistic MACQlog sex age logmj negaff posaff /// urgency1 effortful1 C_senseektot1 DTS1 ALS1 /// , vce(robust) ztnb MACQcnt sex age logmj negaff posaff urgency2 /// effortful2 C_senseektot2 DTS2 ALS2 /// , vce(robust) irr **************************************************************** logistic mjlog sex age negaff posaff urgency /// effortful C_senseektot DTS ALS /// , vce(robust) ztnb mjcnt sex age negaff posaff urgency /// effortful C_senseektot DTS ALS /// if mjcnt>0, vce(robust) irr logistic MACQlog sex age logmj negaff posaff /// urgency effortful C_senseektot DTS ALS /// , vce(robust) ztnb MACQcnt sex age logmj negaff posaff urgency /// effortful C_senseektot DTS ALS /// , vce(robust) irr logistic mjlog sex age negaff posaff urgency /// effortful C_senseektot DTS ALS ztnb mjcnt sex age negaff posaff urgency /// effortful C_senseektot DTS ALS /// if mjcnt>0, irr logistic MACQlog sex age logmj negaff posaff /// urgency effortful C_senseektot DTS ALS ztnb MACQcnt sex age logmj negaff posaff urgency /// effortful C_senseektot DTS ALS /// , irr log close