The `mp_dropmembers` macro is not intended to create new data or to directly read data from external sources or SASHELP. Its role is to manage and delete existing tables and views within a user-specified library (`libref`). Usage examples mention `sashelp.class` for creating temporary tables for demonstration purposes, but this does not constitute a direct dependency of the macro.
1 Code Block
MACRO mp_dropmembers
Explanation : This block defines the `mp_dropmembers` macro with three parameters: `list` (list of objects to delete), `libref` (target library, default 'WORK'), and `iftrue` (execution condition, default '1=1'). The macro first checks the `iftrue` condition and exits if it is false. Then, it checks if the `list` of objects is empty using the `mf_isblank` macro; if so, it displays a note and exits. If the list is not empty, it uses `PROC DATASETS` to delete the objects. Two `DELETE` commands are used: one for tables and another for views (`/mtype=view`), ensuring robust deletion without generating errors if the object does not exist or is not of the specified type.
Copied!
%macro mp_dropmembers(
list /* space separated list of datasets / views */
,libref=WORK /* can only drop from a single library at a time */
,iftrue=%str(1=1)
)/*/STORE SOURCE*/;
%if not(%eval(%unquote(&iftrue))) %then %return;
%if %mf_isblank(&list) %then %do;
%put NOTE: nothing to drop!;
%return;
%end;
proc datasets lib=&libref nolist;
delete &list;
delete &list /mtype=view;
run;
%mend mp_dropmembers;
1
%macro mp_dropmembers(
2
list /* space separated list of datasets / views */
3
,libref=WORK /* can only drop from a single library at a time */
4
,iftrue=%str(1=1)
5
)/*/STORE SOURCE*/;
6
7
%IF not(%eval(%unquote(&iftrue))) %THEN %return;
8
9
%IF %mf_isblank(&list) %THEN %DO;
10
%put NOTE: nothing to drop!;
11
%return;
12
%END;
13
14
PROC DATASETS lib=&libref nolist;
15
delete &list;
16
delete &list /mtype=view;
17
RUN;
18
%mend mp_dropmembers;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright (c) 2001-2006 Rodney Sparapani. This file is free software distributed under the terms of the GNU General Public License (GPL) version 2 or later.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.