Statalist The Stata Listserver


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

Re: st: version 5.0 to version 9.2


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: version 5.0 to version 9.2
Date   Thu, 21 Jun 2007 17:17:13 -0400

Raphael Fraser <[email protected]>:
The command -for- was followed by a list, in this case a list of
variables, and the @ specified where each item in the list was to be
substituted in repeating the command after the colon.  So that code
would become:
foreach v of varlist temp* {
 gen r`v'=cond(`v'==1,res,.)
 }
foreach v of varlist temp* {
 bys `3': replace `v'=sum(`v')
 by `3': replace `v'=`v'[_N]
 replace `v'=cond(`v'==0,.,`v')
}
in a more modern Stata.
Or perhaps:
foreach v of varlist temp* {
 g r`v'=res if `v'==1
 egen s`v'=total(`v'), by(`3')
 replace s`v'=. if s`v'==0
}


On 6/21/07, Raphael Fraser <[email protected]> wrote:
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