Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: RE: RE: RE: Undocumented limitation of describe (and hence -ds-) in Stata 10?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: RE: RE: Undocumented limitation of describe (and hence -ds-) in Stata 10?
Date   Wed, 7 Apr 2010 12:03:33 +0100

I see what you mean. Yes, the -display- command mixes a pure display
role and a calculator role and its behaviour is not typical of many
other commands. Conversely, quite a lot of "printing" functions in
various languages allow calculations on the fly. 

Nick 
[email protected] 

Martin Weiss

The one that I gave in
http://www.stata.com/statalist/archive/2010-04/msg00269.html last night,
for
instance:

***
sysuse auto, clear
su mpg
di r(mean)
di `r(mean)'
di "`r(mean)'"
***

Nick Cox

What examples do you have in mind? 

Nick 
[email protected] 

Martin Weiss

The confusion is compounded by -display-'s uncanny ability to somehow
circumvent the requirement for single quotes: As it takes an
-expression-,
it knows beforehand it needs to evaluate. Many users take its behavior
as
representative of the rest of Stata, I think...

Nick Cox

I think of ` ' as meaning "evaluate this here and now". Here should be
obvious, but the now is important too, meaning precisely "before you try
to execute this command line". 

`macname' is the canonical example for local macro macname. But

`= 2 + 2' 

`c(date)'

`r(varlist)' 

`e(cmdline)' 

`: value label foreign' 

are other examples in which you also want literal text substituted. I
don't know if this is ever official wording -- indeed I doubt it -- but
I think of examples other than the first as invoking the local macro
persona of beasts that are not local macros in the most restricted sense
but can behave similarly given persuasive syntax. 

Nick 
[email protected] 

Michael I. Lichter

I understand that single quotes are not simply local macro dereference 
operators, but it certainly looks like that's their function in the 
command line. Other than local macro, what can you dereference in this
way?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index