Introduction

A PROC SQL view is a stored query expression that reads data values from its underlying files, which can include SAS data files, DATA step views, other PROC SQL views, or DBMS data.

You can refer to views in queries as if they were tables. The view derives its data from the tables or views that are listed in its FROM clause. The data that is accessed by a view is a subset or superset of the data that is in its underlying table(s) or view(s).


     proc sql;
        create view sasuser.raisev as
           select empid, jobcode, 
                  salary format=dollar12.2, 
                  salary/12 as MonthlySalary
                  format=dollar12.
              from payrollmaster;
        select *
           from sasuser.raisev
           where jobcode in ('PT2','PT3');

EmpID JobCode Salary MonthlySalary
1333 PT2 $124,048.00 $10,337.33
1404 PT2 $127,926.00 $10,660.50
1118 PT3 $224,540.64 $18,711.72
1410 PT2 $118,559.00 $9,879.92
1777 PT3 $221,014.08 $18,417.84
1106 PT2 $125,485.00 $10,457.08
1442 PT2 $118,350.00 $9,862.50
1478 PT2 $117,884.00 $9,823.67
1890 PT2 $120,254.00 $10,021.17
1107 PT2 $125,968.00 $10,497.33
1830 PT2 $118,259.00 $9,854.92
1928 PT2 $125,801.00 $10,483.42


PROC SQL views

  • can be used in SAS programs in place of an actual SAS data file
  • can be joined with tables or other views
  • can be derived from one or more tables, PROC SQL views, or DATA step views
  • can access data from a SAS data set, a DATA step view, a PROC SQL view, or a relational database table
  • extract underlying data, which enables you to access the most current data.

30 minutes



In this lesson, you learn to

  • create and use PROC SQL views
  • display the definition for a PROC SQL view
  • manage PROC SQL views
  • update PROC SQL views
  • drop (delete) PROC SQL views.

complete the following lessons:

  • .