Surely. Note that `3' must be determined
upstream of this for it to work, in both 5.0
and 9.2.
foreach v of var temp* {
gen r`v' = cond(`v' == 1, res, .)
by `3' : replace r`v' = sum(r`v')
by `3' : replace r`v' = r`v'[_N]
replace r`v' = . if r`v' == 0
}
-for- was the first command demanding fortitude
from Stata users.
Nick
[email protected]
Raphael Fraser
> Can any one convert the following code to Stata 9.2 syntax? I am not
> sure what the "@" means.
>
> version 5.0
> for temp* : gen r@=cond(@==1,res,.)
> for rtemp*: by `3': replace @=sum(@)
> for rtemp*: by `3': replace @=@[_N]
> for rtemp*: replace @=cond(@==0,.,@)
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/