SQL procedure

From sasCommunity
(Redirected from PROC SQL)
Jump to: navigation, search

Within SAS, the SQL procedure is used to run SQL queries on data set(s) or database(s). The differences between PROC SQL and the DATA Step and advantages of each have been discussed in various papers; see PROC SQL vs. DATA Step.

Using PROC SQL

   proc sql <options>;
       <SQL statement(s)>
   quit;

Multiple SQL queries may be run from the same PROC SQL step.

There are many uses of the SQL procedure, including creating, modifying,[1] and joining data sets. To delve into some of the examples of what you can do, see the pages in the SQL Procedure category.

PROC SQL options

Optional <options> that may be passed at the beginning of a PROC SQL step include inobs= and outobs= to limit the number of observations read in or output, NOPRINT to suppress printing results in a report, respectively, and feedback to write more information to the log, method to change how PROC SQL operates. A more comprehensive list is available here.

Further reading

Introductory papers and articles

SAS Documentation and publications

Books

Wiki articles on specific topics

Blogs and other websites