Sorting Your Output


You can specify the order in which you want the output sorted. In this example, you use the query from the last example and change the ordering sequence of the columns in the Output window. From the SQL QUERY COLUMNS window, select
View Order By

click to expand

Move Before

displays all columns in the Order By Columns list except the currently chosen one. The currently chosen column(s) will be inserted before the column(s) that you select.

Move After

displays all the columns in the Order By Columns list except the currently chosen one. The currently chosen column(s) will be inserted following the column(s) that you select.

Ascending Order

changes the ordering sequence of the selected column's values to ascending ( lowest value to highest value).

Descending Order

changes the ordering sequence of the selected column's values to descending.

Build a Column

displays the Build a Column Expression window, which enables you to create a calculated column for use in sorting your output. Use the Build a Column Expression window to create new columns by performing calculations on existing (numeric) columns.

Order by Columns

Select BEGDATE from the Available Columns list. Select the right arrow to move the column to the Order By Columns list. By default, columns are sorted in ascending order, so the abbreviation ASC appears next to the column name in the Order By Columns list. Select BEGDATE ASC and Descending Order to change the ordering sequence.

click to expand

Select Salary and JOBCODE , and move them to the Order By Columns list.

Move Columns

Select Salary ASC from the Order By Columns list and select Move Before . The Move Columns window appears.

click to expand

Select BEGDATE and OK . The ORDER BY COLUMNS window appears with Salary first in the Order By Columns list.

click to expand

Select OK to return to the SQL QUERY COLUMNS window.

Select
View Where Conditions for Subset

The WHERE EXPRESSION window appears. Select Undo four times, until only SALARY LT $18,000 is displayed.

click to expand

Select OK .

Viewing Your Output

To run your query and view the output in the Output window, select
Tools Run Query Run Immediate

click to expand



SAS 9.1 SQL Query Window. Users Guide
SAS 9.1 SQL Query Window: Users Guide
ISBN: 1590472098
EAN: 2147483647
Year: 2004
Pages: 54
Authors: SAS Institute

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net