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

Re: st: forvalues question


From   Radu Ban <rban@nber.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: forvalues question
Date   Tue, 22 Apr 2003 17:54:07 -0400 (EDT)

i'm not sure, but it might be that -forvalues- must be followed by a valid
range and 84 86 is not a valid range. try

foreach Y of numlist 84 86 {;
...




On Tue, 22 Apr 2003 ACavallo@lexecon.com wrote:

> > since you set the delimiter to ";" you have to put one
> > after the opening "{". as you can see in the log file
> > stata thinks the line end is after replace.
>
> Adding the ; did not fix the problem.
>
> My log file now looks like this ...
>
> delimiter now ;
> . forvalues Y = 84 86 {;
>   2. log using make`Y'.log, text replace;
>   3. global yr `Y';
>   4. do read`Y';
>   5. do lbl`Y';
>   6. do common;
>   7. gen index=_n;
>   8. label var index "Record number";
>   9. gen int panelyr=1900 + `Y';
>  10. replace panelyr=2000 + `Y' if `Y'<=3;
>  11. label var panelyr "SIPP Survey Year";
>  12. compress;
>  13. aorder;
>  14. order panelyr wave index;
>  15.  save sipp`Y'.dta,replace;
>  16. do month;
>  17. save sipp`Y'm.dta,replace;
>  18. log close;
>  19. };
> invalid syntax
> r(198);
>
> end of do-file
> r(198);
>
>
> Regards,
>
> --Alex Cavallo
> Lexecon
> (312) 322-0208  voice
> (312) 322-0218  fax
>
>
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index