Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Simple question about sorted datasets


From   [email protected]
From   "Mark Schaffer <[email protected]> asks:"@hsph.harvard.edu
To   [email protected]
Subject   Re: st: Simple question about sorted datasets
Date   Thu, 30 Sep 2004 17:05:27 -0500

> I want a program to be able to find out if the dataset in memory is 
> sorted.  If possible, I also want it to be able to find out what the sort 
> variables are.  But I don't want the dataset to get sorted in the process.

Look at -help macro-.  The extended macro function -sortedby-
will give you what you want.  For instance,

    . sysuse auto
    . local cursort : sortedby
    . di "`cursort'"

Would show you that the auto dataset is sorted on the "foreign"
variable.

Ken Higbee    [email protected]
StataCorp     1-800-STATAPC

*
*   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/



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