8.8. Deleting Views

When a view is no longer needed, it’s nice to know there is a way to remove it. Without this ability, program maintenance activities would be made more difficult. To remove an unwanted view, specify the DROP VIEW statement and the name of the view. In the next example, the INVENTORY_VIEW view is deleted from the WORK library.

SQL Code

PROC SQL;
  DROP VIEW INVENTORY_VIEW;
QUIT;

SAS Log

        PROC SQL;
          DROP VIEW INVENTORY_VIEW;
   NOTE: View WORK.INVENTORY_VIEW has been dropped.
        QUIT;
   NOTE: PROCEDURE SQL used:
         real time           0.10 seconds

When more than a single view needs to be deleted, the DROP VIEW statement works equally as well. Specify a comma between each view name when deleting two or more views.

SQL Code

PROC SQL; DROP VIEW INVENTORY_VIEW, ...

Get PROC SQL: Beyond the Basics Using SAS® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.