BookmarkSubscribeRSS Feed
PatrykSAS
Obsidian | Level 7

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.

Replacing "by" with "class" or adding "notsorted" wouldn't solve problem due to not correct calculations.
Do you have any suggestions?

 

3 REPLIES 3
Astounding
PROC Star

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.

AMSAS
SAS Super FREQ

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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1723 views
  • 0 likes
  • 4 in conversation