Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: trickier subscript question


From   <[email protected]>
To   <[email protected]>
Subject   st: RE: trickier subscript question
Date   Fri, 2 Apr 2004 11:19:20 +1000

How about replacing "gen j = i-1" to "local j = `i' - 1"?

Jisheng Cui.
Melbourne.





Thank you to everyone for your replies. Now I need to do something
tricky with my looping: I need to refer to b1_0X and b1_0(X-1) in the
same command. Something like this:

forvalues i = 1(1)9 {
gen j = i - 1
gen newvar = b1_0`i' - b1_0`j'
}

Unfortunately, Stata doesn't recognize i as a variable. Any suggestions?
Thanks so much to everyone for your help.

Best,
Kenley

*
*   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/

*
*   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