> -----Original Message-----
> From: David Kantor [mailto:[email protected]]
> Sent: Tuesday, August 13, 2002 1:00 PM
> To: [email protected]
> Subject: Re: st: RE: Parsing of multiple -if- lines
>
>
> At 12:33 PM 8/13/2002 -0400, Nick Winter wrote:
>
> >When the -else- clause is removed, then the program crashes only when
> >the second token is set to an asterisk, suggesting that it is the
> >comments in there that are somehow confusing things?
>
> I'm not totally clear about this, but I think that Stata
> expects a loaded
> program to have no commented-out text. That is, any
> commented-out text it
> finds at load time is stripped out; once loaded, a program has no
> comments. (Do -program list-; you will see: no more
> comments.) But now
> you are introducing a new twist: parts of the program become
> commented-out
> at run time. Perhaps the comment-skipping feature does not
> operate (at
> least, not completely) while running a program, as it is
> presumed to have
> already gone through that step at load time.
Interestingly, although Stata drops any commented lines when loading a
program, it is also happy to encounter comments as it interprets the
lines at execution. The local macros `1' '2', are not substituted until
runtime, so the lines remain.
This simpler version makes it clear:
prog define myprog3
`1' di "line one"
`2' di "line two"
`3' di "line three"
end
. myprog3 " " " " " "
line one
line two
line three
. myprog3 " " " " "*"
line one
line two
--Nick Winter
*
* 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/