Deletes an observation from a SAS data set.
| Valid in: | DATA step |
|---|---|
| Category: | Action |
| Type: | Executable |
| Restrictions: | This statement is not supported in a DATA step that runs in CAS. |
| Use only with a MODIFY statement. |
Table of Contents
If you specify no argument, the REMOVE statement deletes the current observation from all data sets that are named in the DATA statement.
specifies the data set in which the observation is deleted.
| Restriction | The data set name must also appear in the DATA statement and in one or more MODIFY statements. |
|---|---|
| Tip | Instead of using a data set name, you can specify the physical pathname to the file, using syntax that your operating system understands. The pathname must be enclosed in single or double quotation marks. |
The deletion of an observation can be physical or logical, depending on the engine that maintains the data set. Using REMOVE overrides the default replacement of observations. If a DATA step contains a REMOVE statement, you must explicitly program all output for the step.
This example removes one observation from a SAS data set.
libname perm 'SAS-library';
data perm.accounts;
input AcctNumber Credit;
datalines;
1001 1500
1002 4900
1003 3000
;
data perm.accounts;
modify perm.accounts;
if AcctNumber=1002 then remove;
run;
proc print data=perm.accounts;
title 'Edited Data Set';
run;
Here are the results of the PROC PRINT statement:
