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: how to access Stata's record of the variable data is sorted on
From
Phil Schumm <[email protected]>
To
<[email protected]>
Subject
Re: st: how to access Stata's record of the variable data is sorted on
Date
Tue, 24 Sep 2013 14:35:45 -0500
On Sep 24, 2013, at 1:46 PM, Nick Cox <[email protected]> wrote:
> . mata :
> : which = "foreign"
> : which == sprintf("`: sortedby'")
This will work interactively, but not in a function, since the expansion will occur at compile time instead of runtime. Alternatives that work inside a function include:
printf(st_macroexpand("`" + ":sortedby" + "'"))
or
stata("des, varl", 1)
printf(st_global("r(sortlist)"))
and possibly others that I don't know about. Seems odd that the current sort order is not available via c()...
-- Phil
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/