Problem Note 56734: The group order sorting algorithm with the GROUPORDER= option set to ASCENDING or DESCENDING differs from the default sorting algorithm
When you create a grouped bar chart with the SGPLOT or SGPANEL procedure, the bars are sorted using an ASCII binary sort by default.
However, when you specify the GROUPORDER=ASCENDING or GROUPORDER=DESCENDING option in the HBAR or VBAR statement in PROC SGPLOT or PROC SGPANEL, the bars are sorted using a linguistic sorting algorithm.
To ensure that your bars are sorted using the desired algorithm, sort your data using PROC SORT with the SORTSEQ option to specify the sort sequence. Then include the GROUPORDER=DATA option in the HBAR or VBAR statement in PROC SGPANEL or PROC SGPLOT.
Click the Full Code tab to see sample code that creates a descending bar chart using a binary sort.
Operating System and Release Information
SAS System | Base SAS | Linux | 9.3 TS1M2 | |
Linux for x64 | 9.3 TS1M2 | |
Solaris for x64 | 9.3 TS1M2 | |
HP-UX IPF | 9.3 TS1M2 | |
64-bit Enabled Solaris | 9.3 TS1M2 | |
64-bit Enabled HP-UX | 9.3 TS1M2 | |
64-bit Enabled AIX | 9.3 TS1M2 | |
Windows Vista for x64 | 9.3 TS1M2 | |
Windows Vista | 9.3 TS1M2 | |
Windows 7 Ultimate x64 | 9.3 TS1M2 | |
Windows 7 Ultimate 32 bit | 9.3 TS1M2 | |
Windows 7 Professional x64 | 9.3 TS1M2 | |
Windows 7 Professional 32 bit | 9.3 TS1M2 | |
Windows 7 Home Premium x64 | 9.3 TS1M2 | |
Windows 7 Home Premium 32 bit | 9.3 TS1M2 | |
Windows 7 Enterprise x64 | 9.3 TS1M2 | |
Windows 7 Enterprise 32 bit | 9.3 TS1M2 | |
Microsoft Windows XP Professional | 9.3 TS1M2 | |
Microsoft Windows Server 2012 Std | 9.3 TS1M2 | |
Microsoft Windows Server 2012 R2 Std | 9.3 TS1M2 | |
Microsoft Windows Server 2012 R2 Datacenter | 9.3 TS1M2 | |
Microsoft Windows Server 2012 Datacenter | 9.3 TS1M2 | |
Microsoft Windows Server 2008 for x64 | 9.3 TS1M2 | |
Microsoft Windows Server 2008 R2 | 9.3 TS1M2 | |
Microsoft Windows Server 2008 | 9.3 TS1M2 | |
Microsoft Windows Server 2003 for x64 | 9.3 TS1M2 | |
Microsoft Windows Server 2003 Standard Edition | 9.3 TS1M2 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.3 TS1M2 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.3 TS1M2 | |
Microsoft Windows 8.1 Pro 32-bit | 9.3 TS1M2 | |
Microsoft Windows 8.1 Pro | 9.3 TS1M2 | |
Microsoft Windows 8.1 Enterprise x64 | 9.3 TS1M2 | |
Microsoft Windows 8.1 Enterprise 32-bit | 9.3 TS1M2 | |
Microsoft Windows 8 Pro x64 | 9.3 TS1M2 | |
Microsoft Windows 8 Pro 32-bit | 9.3 TS1M2 | |
Microsoft Windows 8 Enterprise x64 | 9.3 TS1M2 | |
Microsoft Windows 8 Enterprise 32-bit | 9.3 TS1M2 | |
Microsoft® Windows® for x64 | 9.3 TS1M2 | |
z/OS 64-bit | 9.3 TS1M2 | |
z/OS | 9.3 TS1M2 | |
*
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.
The sample below illustrates the syntax for creating a descending bar chart using a binary sort.
title 'Descending bars with linguistic sort';
proc sgplot data=sashelp.cars;
where type ne "Hybrid";
vbar origin / response=mpg_city group=type
groupdisplay=cluster stat=mean
grouporder=descending;
run;
proc sort data=sashelp.cars out=cars sortseq=binary;
where type ne "Hybrid";
by descending type;
run;
title 'Descending bars with binary sort';
proc sgplot data=cars;
vbar origin / response=mpg_city group=type
groupdisplay=cluster stat=mean
grouporder=data;
run;
When you use PROC SGPLOT or PROC SGPANEL to create a grouped bar chart and the GROUPORDER= option is not specified, an ascending ASCII binary sort is performed. When the GROUPORDER=ASCENDING or GROUPORDER=DESCENDING option is specified, a linguistic sort is performed.
Type: | Problem Note |
Priority: | medium |
Date Modified: | 2015-10-09 15:15:43 |
Date Created: | 2015-10-07 09:11:06 |