Conditionally Deleting an Observation

If you do not want the program data vector to write to a data set based on a condition, use the DELETE statement in the DATA step. For example, if the tour to Peru has been discontinued, it is no longer necessary to include the observation for Peru in the data set that is being created. The following example uses the DELETE statement to prevent SAS from writing that observation to the output data set:
data subset;
   set mylib.internationaltours;
   if Country = 'Peru' then delete;
run;

proc print data=subset;
   title 'Omitting a Discontinued Tour';
run;
The following output displays the results:
Display 7.8 Deleting an Observation
Deleting an Observation
The observation for Peru has been deleted from the data set.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.123.184