Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Forvalues, syntax error


From   "Neil Shephard" <[email protected]>
To   [email protected]
Subject   Re: st: Forvalues, syntax error
Date   Thu, 5 Jul 2007 15:42:29 +0100

On 7/5/07, Phil Schumm <[email protected]> wrote:
On Jul 5, 2007, at 9:13 AM, Gauri Khanna wrote:
> summarize i
> local max1=r(max)

<snip>

> forvalues svy = 1/`max1' {
> THIS IS THE ERROR I GET
> - forvalues svy = 1/`max1' {
> = forvalues svy = 1/. {
> invalid syntax
> r(198);


The problem is that 1/. is not a valid numeric range.  The local
macro max1 contains "." because your variable i is always missing,
and therefore r(max) is not returned.
Well spotted!  I didn't realise that scalars that are undefined are
represented as missing, although thinking about it this is entirely
logical.

No need to try anything that I said, just ensure that you have values
in your i variable.

Neil

--
"In mathematics you don't understand things. You just get used to
them."  - Johann von Neumann

Email - [email protected] / [email protected]
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/
*
*   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