Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Phil Schumm <pschumm@uchicago.edu> |
To | <statalist@hsphsun2.harvard.edu> |
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 <njcoxstata@gmail.com> 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/