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 11:38:52 -0400 (EDT)

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.



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

> I am getting an error on the following code:
> 
> #delimit ;
> forvalues Y = 84 86 {
> log using make`Y'.log,text replace;
> global yr `Y';
> do read`Y';
> do lbl`Y';
> do common;
> gen index=_n;
> label var index "Record number";
> gen int panelyr=1900 + `Y';
> replace panelyr=2000 + `Y' if `Y'<=3;
> label var panelyr "SIPP Survey Year";
> compress;
> aorder;
> order panelyr wave index;
> save sipp`Y'.dta,replace;
> do month;
> save sipp`Y'm.dta,replace;
> log close;
> };
> 
> 
> Stata log ...
> 
> . forvalues Y = 84 86 {
> > log using make`Y'.log,text replace;
>   2. global yr `Y';
>   3. do read`Y';
>   4. do lbl`Y';
>   5. do common;
>   6. gen index=_n;
>   7. label var index "Record number";
>   8. gen int panelyr=1900 + `Y';
>   9. replace panelyr=2000 + `Y' if `Y'<=3;
>  10. label var panelyr "SIPP Survey Year";
>  11. compress;
>  12. aorder;
>  13. order panelyr wave index;
>  14.  save sipp`Y'.dta,replace;
>  15. do month;
>  16. save sipp`Y'm.dta,replace;
>  17. log close;
>  18. };
> invalid syntax
> r(198);
> 
> end of do-file
> r(198);
> 
> 
> What am I doing wrong?
> 
> 
> 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