Writing a PROC SQL Step

Overview

Before creating a query, you must first reference the library in which your table is stored. Then you write a PROC SQL step to query your table.
General form, basic PROC SQL step to perform a query:
PROC SQL;
SELECT column-1<,...column-n>
FROM table-1|view-1<,...table-n|view-n>
<WHERE expression>
<GROUP BY column-1<, ... column-n>>
<ORDER BY column-1<,... column-n>>;
Here is an explanation of the syntax:
PROC SQL
invokes the SQL procedure
SELECT
specifies the column(s) to be selected
FROM
specifies the table(s) to be queried
WHERE
subsets the data based on one or more conditions
GROUP BY
classifies the data into groups based on the specified column(s)
ORDER BY
sorts the rows ...

Get SAS Certification Prep Guide, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.