Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mp_dropmembers.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Drops tables / views (if they exist) without warnings in the log
4  @details
5  Example usage:
6 
7  proc sql;
8  create table data1 as select * from sashelp.class;
9  create view view2 as select * from sashelp.class;
10  %mp_dropmembers(list=data1 view2)
11 
12  <h4> Dependencies </h4>
13  @li mf_isblank.sas
14 
15 
16  @param list space separated list of datasets / views
17  @param libref= can only drop from a single library at a time
18 
19  @version 9.2
20  @author Allan Bowe
21 
22 **/
23 
24 %macro mp_dropmembers(
25  list /* space separated list of datasets / views */
26  ,libref=WORK /* can only drop from a single library at a time */
27 )/*/STORE SOURCE*/;
28 
29  %if %mf_isblank(&list) %then %do;
30  %put NOTE: nothing to drop!;
31  %return;
32  %end;
33 
34  proc datasets lib=&libref nolist;
35  delete &list;
36  delete &list /mtype=view;
37  run;
38 %mend;