use "D:\Projet OH\SNF\TREE2\Data_Stata_less-variables_05042022.dta" 

svyset _n [pweight=wt_t2cc_trunc], vce(linearized) singleunit(missing)


gen t1alcool=.
replace t1alcool=0 if (t1drugfreq1==1)
replace t1alcool=1 if (t1drugfreq1==2)
replace t1alcool=2 if (t1drugfreq1>2)

gen t2alcool=.
replace t2alcool=0 if (t2drugfreq1==1)
replace t2alcool=1 if (t2drugfreq1==2)
replace t2alcool=2 if (t2drugfreq1>2)

gen t1alc2=.
replace t1alc2=0 if (t1drugever1==0)
replace t1alc2=1 if (t1drugever1==1 & t1drugfreq1==2)
replace t1alc2=2 if (t1drugever1==1 & t1drugfreq1>2)

gen t2alc2=.
replace t2alc2=0 if (t1drugever1==0 & t2drugfreq1==1)
replace t2alc2=1 if (t2drugfreq1==2)
replace t2alc2=2 if (t2drugfreq1>2)



gen t1alc=.
replace t1alc=0 if (t1drugever1==0)
replace t1alc=1 if (t1drugever1==1 & (t1drugfreq1==2 | t1drugfreq1==1))
replace t1alc=2 if (t1drugever1==1 & t1drugfreq1>2)

gen t2alc=.
replace t2alc=0 if (t1drugever1==0 & t2drugfreq1==1)
replace t2alc=1 if (t2drugfreq1==2)
replace t2alc=2 if (t2drugfreq1>2)

gen t2alc2=.
replace t2alc2=0 if (t2drugfreq1==1)
replace t2alc2=1 if (t2drugfreq1==2)
replace t2alc2=2 if (t2drugfreq1>2)


svy: tab t1alc t2alc2, count col row