Good point. In Stata 7 and 8 you can 
get there in one 
di "`: sortedby'" 
which shows nothing if Stata is unaware of
a sort order. 
Nick 
[email protected] 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Kit Baum
> Sent: 04 November 2004 15:05
> To: [email protected]
> Subject: st: sorting order
> 
> 
> Barbara asked
> And second, is there any command (e.g. assert) in order to check the 
> sort sequence and only in case of being unsorted sorts the data?
> 
> Nick Cox' reply indicated that unneeded sorts would not be performed. 
> But this part of her question remains, and it might be useful to know 
> how to do this:
> 
> . sort foreign rep78
> 
> . local sorted: sortedby
> 
> . di "`sorted'"
> foreign rep78
> 
> whelp extended_fcn for the gory details.
> 
*
*   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/