LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (January 2007, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 31 Jan 2007 18:31:18 -0500
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:      Re: OT: Chance to Make SAS-L History: Did You Know That...
Comments: To: David Johnson <David.Johnson@CBA.COM.AU>

David,

I'm answering your question via the "Did you know that" thread, because it reminded me of a thread a couple of years ago that is well worth repeating.

Did you know that: When running a proc sort on a data file that already has a sortedby flag set for the sort order of interest, the sort won't work unless you include the FORCE option?

The thread where this was discussed can be found at: http://xrl.us/ukeu

Art --------- On Thu, 1 Feb 2007 09:44:30 +1100, Johnson, David <David.Johnson@CBA.COM.AU> wrote:

>Time for a different soapbox... > >A colleague in the Apple wanted a large amount of data that took some >hours to prepare for transmission. > >In preparing the tables, I used the SortedBy flag to identify the data >order and simplify reconstruction and indexing. > >For my 2 / 100 of local currency: where the data is ordered (and I use >that term deliberately), it makes sense to specify on the SAS table >header that it is "SortedBy". As previously remarked, a sort procedure >is skipped if the data is expected to be in the correct order. > >It is also worth noting that if the flag is incorrectly set and an index >is requested on the table, then SAS produces a very helpful message when >it aborts indexing to state that the table is not in the "order... as >asserted". > >It is perhaps unfortunate that the DataSets procedure that attempts to >modify the table and apply the index doesn't remove the SortedBy flag >when the data order is found to differ from the flag assertion. Might >that be a SAS ballot opportunity for the future? > >Kind regards > >David > > >-----Original Message----- >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Lou >Sent: Wednesday, 31 January 2007 1:04 PM >To: SAS-L@LISTSERV.UGA.EDU >Subject: Re: Sorted Columns > >"Deep" <ADSingh78@GMAIL.COM> wrote in message >news:200701301956.l0UJ4b3h011199@mailgw.cc.uga.edu... >> What is the best way to know that the dataset is sorted using which >> variable names. I tried the following but did not help. I am using SAS >v8. >> >> proc sql; >> create table test as >> select * >> from dictionary.columns >> where libname='WORK' and memname='MYDATA'; >> quit; >> >> Please advise. > >The dataset header maintains a flag called (if I remember rightly) >SORTEDBY. >You can read the contents of that flag with PROC CONTENTS, by accessing >the dictionary tables using PROC SQL, or using the dictionary views in a >DATA or PROC step. > >However, it won't tell you if the dataset is in sorted order "by >construction". For instance, the data step > >DATA FEE; > DO N = 1 TO 10; > OUTPUT; > END; > STOP; >RUN; > >produces a dataset that is in the same order as it would be if it had >been sorted on variable N by PROC SORT, but the sorted by flag is blank. > >Further, you can change the value of the flag without sorting the >dataset - if you're feeling particularly malicious, you can set the flag >to say the data set is sorted by some variable(s) when in fact it is >not. > >The "best" way to know a dataset is sorted by some list of variable >names is to sort it just before you're going to use it. > >************** IMPORTANT MESSAGE ***************************** >This e-mail message is intended only for the addressee(s) and contains information which may be >confidential. >If you are not the intended recipient please advise the sender by return email, do not use or >disclose the contents, and delete the message and any attachments from your system. Unless >specifically indicated, this email does not constitute formal advice or commitment by the sender >or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its subsidiaries. >We can be contacted through our web site: commbank.com.au. >If you no longer wish to receive commercial electronic messages from us, please reply to this >e-mail by typing Unsubscribe in the subject line. >**************************************************************


Back to: Top of message | Previous page | Main SAS-L page