Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: version 5.0 to version 9.2


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: version 5.0 to version 9.2
Date   Thu, 21 Jun 2007 22:12:00 +0100

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index