Appendix F. Coming to SAS from SQL

If you already know Structured Query Language (SQL), then you will be pleased to know that you can use SQL statements in SAS programs to create, read, and modify SAS data sets. There are two basic ways to use SQL with SAS:

  • You can embed complete SQL statements in the SQL procedure.

  • You can use WHERE statements to select rows in standard SAS DATA and PROC steps.

Both of these features are available with Base SAS, so you don’t have to license any other SAS software to use SQL.


Terms such as table, row, and column that originated with relational databases are now standard SAS terms also. However, other terms can also be used with SAS. To help you understand SAS terminology, here is a brief dictionary of analagous ...

Get The Little SAS® Book: A Primer, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.