logo Getting Started with SAS Main menuGlossaryBackNext
    

Overview

Structured Query Language (SQL) is a standardized, widely used language that retrieves and updates data in tables and views based on those tables. If you're familiar with SQL, you can quickly create queries in SAS by using the SQL procedure in Base SAS.

PROC SQL is the SAS implementation of SQL. When you want to examine relationships between data values, subset your data, or compute values, the SQL procedure provides an easy, flexible way to analyze your data. Using PROC SQL, you can

  • retrieve and manipulate data that is stored in tables or views.
  • create tables, views, and indexes on columns in tables.
  • create SAS macro variables that contain values from rows in a query's result.
  • add or modify the data values in a table's columns or insert and delete rows. You can also modify the table itself by adding, modifying, or dropping columns.
  • send DBMS-specific SQL statements to a database management system (DBMS) and to retrieve DBMS data.

You can use SAS language elements such as global statements, data set options, functions, informats, and formats with PROC SQL just as you can with other SAS procedures. However, because PROC SQL implements Structured Query Language, it works somewhat differently from other Base SAS procedures.

This task focuses on retrieving data from a single table (data set). For details on joining tables, see Join tables.


Point-and-Click Method

You can create SQL queries using a point-and-click interface.

  1. In SAS, click Toolsthen Query.
  2. Use the SQL Query windows to create queries.

You can view and save the PROC SQL code that the SQL Query window generates.



Main menuGlossaryBackNext