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 Useful for dropping tables when you're not sure they exist, or if
5 you are not sure whether they are a dataset or view. Also efficient for
6 dropping multiple tables / views.
7
8 Example usage:
9
10 proc sql;
11 create table data1 as select * from sashelp.class;
12 create view view2 as select * from sashelp.class;
13 %mp_dropmembers(data1 view2, libref=WORK)
14
15
16 <h4> SAS Macros </h4>
17 @li mf_isblank.sas
18
19
20 @param list space separated list of datasets / views, WITHOUT libref
21 @param libref= (WORK) Note - you can only drop from a single library at a time
22
23 @version 9.2
24 @author Allan Bowe
25
26**/
27
28%macro mp_dropmembers(
29 list /* space separated list of datasets / views */
30 ,libref=WORK /* can only drop from a single library at a time */
31)/*/STORE SOURCE*/;
32
33 %if %mf_isblank(&list) %then %do;
34 %put NOTE: nothing to drop!;
35 %return;
36 %end;
37
38 proc datasets lib=&libref nolist;
39 delete &list;
40 delete &list /mtype=view;
41 run;
42%mend mp_dropmembers;