|
Nat,
Or, rather than being "sloppy" you could set the system option SORTPGM to SAS before running the PROC SORT, and back to BEST afterwards. ;-)
Mike Rhoads
RhoadsM1@Westat.com
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Nat Wooding
Sent: Tuesday, January 24, 2012 8:27 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Coding practices involving the Excel Libname
Good time of the day to wherever you may be.
A few minutes ago, I was playing with some sample code for a friend and in this code, I was reading the data from a workbook using the Libname engine.
My initial code was similar to
Libname getdata 'C:\workbook.xlsx';
Data start;
Set getdata.'sheet1$'n;
Run;
Proc sort data = start ;
By ..
More SAS stuff that included a by statement in a data step.
This did the job nicely but I decided to tighten the code a bit and get rid of the initial data step so it became
Libname getdata 'C:\workbook.xlsx';
Proc sort data = getdata.'sheet1$'n out = start;
By ..
More SAS stuff..
________________________________________________
Now, SAS complains that the data are not sorted properly. A clue about this appears in the log:
NOTE: Sorting was performed by the data source.
NOTE: There were 576 observations read from the data set NO.'rate-variety_RV$'n.
NOTE: The data set WORK.START has 576 observations and 24 variables
So it appears that SAS told Excel to do the sorting and the Excel sort order differs from that used by SAS. And, for once, here is an instance where seemingly sloppy coding is really needed.
Nat Wooding
|