Module Summary: Using SQL in SAS
Module Summary: Using SQL in SAS
The SELECT statement describes the query. List columns to include in the results after SELECT, separated by
commas.
The ORDER BY clause arranges rows based on the columns listed. The default order is ascending. Use DESC
after a column name to reverse the sort sequence.
PROC SQL;
SELECT col-name, col-name
FROM input-table;
QUIT;
Subsetting data:
WHERE expression
Sorting data:
Deleting data:
ON table1.column = table2.column
Assign an alias (or nickname) to a table in the FROM clause by adding the keyword AS and the alias of your
choice. Then you can use the alias in place of the full table name to qualify columns in the other clauses of a
query. Although the AS keyword is not required, it can make the code easier to understand.
Copyright © 2018 SAS Institute Inc., Cary, NC, USA. All rights reserved.