1. The SELECT statement in Proc SQL has two clauses:
- SELECT clause and
- FROM clause
The SELECT clause allows you to select an existing column from a SAS table or create a new column in the output.
The FROM clause specifies the source of data.
2. The Proc SQL step ends with the QUIT statement.
3. You can select multiple columns in the SELECT clause by simply listing the columns, separated by a comma.
4. The asterisk (*) in the SELECT clause tells SAS to select all of the columns from the SAS table.
5. The CASE expression is similar to the if-then statement in data step. It can be used to conditionally assign values to columns.
6. The WHERE clause allows you to retrieve only a subset of rows from the SAS table. When referencing a new column (as opposed to an existing column) in the WHERE clause, the CALCULATED keyword must be used.
7. The IN operator is used in combination with a list of values in the WHERE clause.
8. The CONTAINS operator selects rows where a character column contains a particular string.
9. The LIKE operator selects rows that match a specific pattern. It is often used along with the two wildcard characters; underscore (_) and percentage (%).
10. The ORDER BY clause is used to sort the output.
11. The clauses in the SQL procedure must be listed in this specific order:
- SELECT clause
- FROM clause
- WHERE clause
- GROUP By clause
- HAVING clause
- ORDER By clause
12. The following list of summary functions can be used to summarize data:
13. The GROUP BY clause is used when computing the statistics separately for different groups of data.
14. The HAVING clause is similar to the WHERE clause. However, it is used to filter the table after the data is summarized.
15. A subquery is a query that is nested within another query.