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

Re: Re: st: forvalues question


From   [email protected]
To   [email protected]
Subject   Re: Re: st: forvalues question
Date   Tue, 22 Apr 2003 17:07:45 -0500

Alex Cavallo <[email protected]> says:

> > 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 {;
>
> <cut>

Take a look at the help for -forvalues-.  The range can be
specified in one of four ways.  Just listing some numbers is not
one of the allowed ways.

If you wanted just the values 84 and 86 you could have used

    forvalues Y = 84(2)86 {;

If you wanted the values 84, 85, and 86 you could use

    forvalues Y = 84/86 {;

as well as several other ways.

If you have an arbitrary set of numbers, then you will want to
use the -foreach- command.

When you run into troubles like this you can also -set trace on-
(see help trace) to see which of the many lines of code is giving
you trouble.


Ken Higbee    [email protected]
StataCorp     1-800-STATAPC

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