Problem Note 43203: Dynamic prompt values appear in sorted order instead of retaining data order when the "Use default sort order" option is selected
When a dynamic prompt is defined for use in a SAS® Stored Process, the Sort order field for the prompt contains the following choices:
- Use default sort order
- Ascending by formatted value
- Descending by formatted value
- Ascending by unformatted value
- Descending by unformatted value
Some prompts might ignore the Use default sort order option and present the prompt values in ascending sorted order, instead of retaining the order of the variable values in the data source.
Consider the following example, which illustrates the problem:
A data source contains two variables, RESPONSE and DESCRIPTION
response description
NA Not Applicable
1 Strongly Agree
2 Agree
3 Neither Agree Nor Disagree
4 Disagree
5 Strongly Disagree
? Did not respond
A dynamic prompt is created using the variable RESPONSE for the Unformatted Values column, and using variable DESCRIPTION for the Formatted (Displayed) Values column. Use default sort order is selected for the prompt to retain the order of the values in the data source.
The prompt ignores the Use default sort order option and presents the DESCRIPTION values in ascending sorted order, rather than in the order the values appear in the data source:
Agree
Did Not Respond
Disagree
Neither Agree Nor Disagree
Not Applicable
Strongly Agree
Strongly Disagree
To circumvent this problem, perform the following steps:
- Create a new variable in the data source to establish the desired order for the values of the prompt variable.
In the above example, numeric values 1-7 or character values A-G could be used:
if response="NA" then sort="A";
else if response="1" then sort="B";
...and so on.
- Designate the new variable (SORT) for the Unformatted Values column of the dynamic prompt, and leave the
variable (DESCRIPTION) as the Formatted (Displayed) Values column of the dynamic prompt. Then, select the
Ascending by unformatted value option for the Sort order.
- Modify the underlying SAS Stored Process code to reference the newly created variable values for input parameter processing:
instead of...
...and so on.
Operating System and Release Information
SAS System | SAS Integration Technologies | z/OS | 9.2 TS2M0 | 9.3 TS1M2 |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M0 | 9.3 TS1M2 |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M0 | 9.3 TS1M2 |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M0 | 9.3 TS1M2 |
Microsoft Windows XP 64-bit Edition | 9.2 TS2M0 | 9.3 TS1M2 |
Microsoft® Windows® for x64 | 9.2 TS2M0 | 9.3 TS1M2 |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS2M0 | 9.3 TS1M2 |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS2M0 | 9.3 TS1M2 |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS2M0 | 9.3 TS1M2 |
Microsoft Windows Server 2003 for x64 | 9.2 TS2M0 | 9.3 TS1M2 |
Microsoft Windows Server 2008 for x64 | 9.2 TS2M0 | 9.3 TS1M2 |
Microsoft Windows XP Professional | 9.2 TS2M0 | 9.3 TS1M2 |
Windows Vista | 9.2 TS2M0 | 9.3 TS1M2 |
Windows Vista for x64 | 9.2 TS2M0 | 9.3 TS1M2 |
64-bit Enabled AIX | 9.2 TS2M0 | 9.3 TS1M2 |
64-bit Enabled HP-UX | 9.2 TS2M0 | 9.3 TS1M2 |
64-bit Enabled Solaris | 9.2 TS2M0 | 9.3 TS1M2 |
HP-UX IPF | 9.2 TS2M0 | 9.3 TS1M2 |
Linux | 9.2 TS2M0 | 9.3 TS1M2 |
Linux for x64 | 9.2 TS2M0 | 9.3 TS1M2 |
OpenVMS on HP Integrity | 9.2 TS2M0 | 9.3 TS1M2 |
Solaris for x64 | 9.2 TS2M0 | 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.
Dynamic prompt values appear in sorted order instead of retaining data order when the "Use default sort order" option is selected.
Type: | Problem Note |
Priority: | medium |
Topic: | Query and Reporting ==> Interactive Querying Query and Reporting
|
Date Modified: | 2012-01-04 10:51:28 |
Date Created: | 2011-05-09 12:22:48 |