Hello. I have a problem with the title error. What I've done:
PROC SORT data=WORK.SORT;
BY OWNER TARYFA PRODUKT_TARYFA;
run;
PROC MEANS data=WORK.SORT;
BY OWNER TARYFA PRODUKT_TARYFA;
VAR WOLUMEN_MWH_KONWERSJA;
OUTPUT OUT=WORK.TEST Q1= Q3= /autoname;
RUN;
After the above code, I get an error:
ERROR: Data set WORK.SORT is not sorted in ascending sequence. The current BY group has OWNER = Deweloperzy, Wspólnoty i and the next BY group has OWNER = DEW.
Show the log.
Only an obscure set of conditions could produce this result.
You would see this easily by reading the log. There should be some sort of message about PROC SORT being skipped.
Always read the log. Always show the log if you expect help instead of a guess.
Appears to work fine with some simple test data
data have ;
input owner $ ;
do n=1 to 5 ;
output ;
end ;
cards ;
Deweloperzy
DEW
;
proc sort data=have out=srtd ;
by owner ;
run ;
proc means data=srtd ;
by owner ;
var n ;
output out=WORK.have Q1= Q3= /autoname;
RUN;
Log:
68 data have ;
69 input owner $ ;
70 do n=1 to 5 ;
71 output ;
72 end ;
73 cards ;
NOTE: The data set WORK.HAVE has 10 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
76 ;
77
78 proc sort data=have out=srtd ;
79 by owner ;
80 run ;
NOTE: There were 10 observations read from the data set WORK.HAVE.
NOTE: The data set WORK.SRTD has 10 observations and 2 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
81
82 proc means data=srtd ;
83 by owner ;
84 var n ;
85 output out=WORK.have Q1= Q3= /autoname;
86 RUN;
NOTE: There were 10 observations read from the data set WORK.SRTD.
NOTE: The data set WORK.HAVE has 2 observations and 5 variables.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
Can you create a simple input "have" dataset to replicate the issue and provide the code and log
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.