Chapter Contents |
Previous |
Next |
SAS SQL Query Window User's Guide |
You can use the FORMAT procedure to define additional output formats.
In the PROGRAM EDITOR window, submit the following SAS code:
proc format; value edlevel 1-12 = 'No High School Diploma' 12 = 'High School Diploma' 13 = 'Completing Associate' 14 = 'Associate' 15 = 'Completing Bachelors' 16 = 'Bachelors' 17 = 'Completing Masters' 18 = 'Masters' 19 = 'Completing PhD' 20-99 = 'PhD' . = 'No Education Data';
Invoke the SQL Query Window by typing
queryon the PROGRAM EDITOR window command line.
In the SQL QUERY TABLES window, select SAMPLE.EMPINFO from the list
of Available Tables and add it to the list of Selected Tables. Select
OK
.
In the SQL QUERY COLUMNS window, select NAME and Education Level from the Available Columns List and add them to the list of Selected Columns.
Using the Column Formats Window to List Your Format |
Select
Education
Level
from the Selected Columns List. Select
Column Formats
to display the Column Formats window.
Select [→] next to
Format=
to display a list
of Format Names.
Select EDLEVEL from the list of Format Names. Select
OK
to return to the Column Formats window. Select
OK
to return to the SQL
QUERY COLUMNS window.
Select
View | Where Conditions for Subset... |
to display the WHERE EXPRESSION window. Select
Education
Level
from the list of Available Columns. Select
EQ
from the list of Column Operators.
Using the Format Procedure to Assign Lookup Values |
Select
<LOOKUP distinct values>
from the list of Available Columns. The list of Lookup Values contains the
distinct values for the Education Level column using the format you defined
for EDLEVEL.
Select
PhD
from the list. Because the EQ operator can take
only one value, you are automatically returned to the WHERE EXPRESSION window.
Select
OK
to return to SQL QUERY COLUMNS window.
Viewing Your Output |
Select
Tools | Run Query | Run Immediate |
to display a list of the employees whose education level is PhD.
Select
Tools | Reset |
to reset the query.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.