Notes
Variable créée à partir des variables nbgross_r, d11m_3 et d11s_3
Programme Stata :
local i= 0
capture drop d11_r*
gen sampled10= inlist(gross_r,2,3)
foreach var of newlist d11_r1 - d11_r15 {
capture drop sampled11_*
gen sampled11_`i'= sampled10==1&(nbgross_r>=`i'+1)
tab d11_`i' sampled11_`i', miss
gen s1= d11m_`i'*30.4 if sampled11_`i'==1
gen s2= d11s_`i'*7 if sampled11_`i'==1
egen `var'= rowtotal(s1 s2) if sampled11_`i'==1
replace `var'= . if sampled11_`i'==0 /*| (!inrange(d11m_`i',1,12) & !inrange(d11s_`i',1,4) )*/
*replace `var'=`var'/30.4
*replace `var'=round(`var')
replace `var'=. if `var'==0
tab `var' sampled11_`i', miss
drop s1 s2 sampled11_`i'
local i= `i' + 1