SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 66181: The error message "BY variables are not properly sorted…" occurs after running a DATA step that includes both a WHERE clause and the SINGLE=YES option

DetailsHotfixAboutRate It

In SAS® Cloud Analytic Services (CAS), running a DATA step that both contains a WHERE clause and has the SINGLE=YES option set produces the following error:

ERROR: BY variables are not properly sorted on data set CAS-table-name.

The following example code reproduces this issue:

data casuser.test;
   set sashelp.class;
run;
proc sort data=casuser.test nodupkey;
by name;
run;
data casuser.new / single=yes;
   set casuser.test(where=(weight<1000));
   by name;
run;

Log output (with errors) that is similar to the following is then produced:

88 data casuser.new / single=yes;
89 set casuser.test(where=(weight<1000));
90 by name;
91 run;
NOTE: Running DATA step in Cloud Analytic Services.
ERROR: BY variables are not properly sorted on data set CASUSER.TEST.
Name=Mary Sex=F Age=15 Height=66.5 Weight=112 FIRST.Name=1 LAST.Name=1 _ERROR_=1 _N_=3
ERROR: The action stopped due to errors.
NOTE: The SAS System stopped processing this step because of errors.

You can circumvent this problem by using a subsetting IF statement in place of the WHERE clause:

data casuser.new / single=yes;
   set casuser.test;
   if weight<1000;
   by name;
run;

Click the Hot Fix tab in this note for a link to instructions about accessing and applying the software update.



Operating System and Release Information

Product FamilyProductSystemProduct ReleaseSAS Release
ReportedFixed*ReportedFixed*
SAS SystemSAS ViyaLinux for x643.53.5ViyaViya
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.