Having looked at join queries, we have already got a feel for how Proc SQL works. Let us review the essentials to put us on a firm footing before we explore macros in Proc SQL.
Proc SQL essentials
Subsetting
The simplest way to subset a dataset is by using the Where statement in Proc SQL. The general syntax of such a query is:
Proc SQL;
Select *
From
Where
;
Quit;
You can also subset using the drop and keep option. This is a good way to restrict the variables that are needed in the output dataset. Remember that subsetting is crucial in Proc SQL as the default is the Cartesian product. Any amount of filtering that can be done will reduce the number of rows processed and thereby make...