Previous Page | Next Page

Creating and Updating Tables and Views

Deleting Rows

The DELETE statement deletes one or more rows in a table or in a table that underlies a PROC SQL or SAS/ACCESS view. For more information about deleting rows from views, see Updating a View. The following DELETE statement deletes the names of countries that begin with the letter R:

proc sql;
   delete
      from sql.newcountries
      where name like 'R%';

A note in the SAS log tells you how many rows were deleted.

SAS Log for DELETE statement

NOTE: 1 row was deleted from SQL.NEWCOUNTRIES.

Note:   For PROC SQL tables, SAS deletes the data in the rows but retains the space in the table.  [cautionend]

CAUTION:
If you use the DELETE statement without a WHERE clause, then all rows are deleted.   [cautionend]

Previous Page | Next Page | Top of Page