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

st: RE: Using 'For' command


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Using 'For' command
Date   Thu, 15 May 2003 19:41:08 +0100

Fraser, Steven
> 
> I have a series of variables that start with a particular 
> letter ('l' in
> this case).  I would like to generate a new variable that 
> measures the
> change in variable over time (I have another variable 'week').
> 
> I have tried different variants of the following with 
> little success:
> 
> tset week
> for l@ : gen l@ret = (([email protected]@)/l.l@)

I assume Stata 7. 

Your syntax is illegal, as the syntax diagram 
illustrates.

tsset week 
for var l* : gen @ret = (@ - l.@) / l.@  

might be closer to you want. 

Nick 
[email protected] 
*
*   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