gen v511x = .
codebook s309, tab(9999)
replace v511x = s309 if s309>=0 & s309<=96
codebook s308c, tab(9999)
replace v511x = int((s308c-v011)/12) if s308c>=500 & s308c<=1500
replace v511x = 99 if v501==0
local lcutoffs 15 18 20 21 25
foreach lc of local lcutoffs {
gen marr_by_`lc'=0
replace marr_by_`lc'=1 if v511x<`lc'
}
In the above codes, even if we do not assign the never-married women a value of 99 in place of ., they will anyway get a value of 0 when we run the loop. So how is the denominator going wrong? I couldn't get it.