Statalist The Stata Listserver

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

st: RE: RE: RE: RE: Re: Making a unique log file

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: RE: Re: Making a unique log file
Date   Wed, 26 Apr 2006 17:16:19 +0100

For the record, my explanation needs some improvement: 

Stata sees $ and would be prepared for a macro name
following. But no legal macro name follows, so the 
$ is treated as a literal character, as are the 
characters (S_DATE) following. 

[email protected] 

Donald Spady
> Nick and Michael
>   I must blame this on poor eyesight and seeing what I 
> 'expected' to see.
> Thanks for the heads up and the explanation.

Nick Cox
> Michael's code specified curly braces { } in 
> ${S_DATE} 
> and he meant precisely what he wrote. 
> In context, the braces make it clear to Stata precisely what
> is (and what is not) the name of the global macro whose
> contents you want to be inserted at that point. 
> Common or garden parentheses ( ) have no such role 
> and just get taken literally in this context. Also, 
> ordinary algebra in which the choice between { } and ( )
> can just be a matter of taste or convenience is no 
> guide here, as they are not equivalent in Stata. 
> Within 
> $(S_DATE) 
> Stata sees a $ and gears up for a global macro name 
> to follow -- but then the next thing (next token, in 
> Stataspeak) is a parenthesis, which cannot be part
> of a global macro name. The result is that you just get an empty 
> string inserted instead, which is naturally difficult
> to see there. (Be assured, it really is there. Or it
> really isn't there. Same thing in practice, and 
> consult the theologians or philosophers about the
> difference in principle.) 
> So in this command line the substring 
> (S_DATE)
> will be taken literally and no macro subsitution will
> take place. The rest you know, I think. 
> Nick 
> [email protected] 

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index