| Performing Queries Using SQL |
| Writing a PROC SQL
Step |
| To create a query, you must first reference the library where your table is stored. Then you write a basic PROC SQL step to query your table. |
General form, basic PROC SQL step:
PROC SQL; where
|
| The SELECT Statement
The SELECT statement retrieves and displays data. It is made up of clauses, each beginning with a keyword and followed by one or more components. The SELECT statement in the sample code below contains four clauses: a SELECT clause, a FROM clause, a WHERE clause, and an ORDER BY clause. The end of the statement is indicated by the semicolon. |
proc sql;
|-select id,lastname,netpay,grosspay,
| grosspay*.06 as bonus
|----from emplib.payroll
|----where netpay>25000
|----order by lastname;
^
|
![]() ![]() |
|
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.