|
/* 看看是不是这样 */
data data; /* you need to create your own data like this */
input dsn $ action $ dsnn $ in $ out $;
datalines;
class c class_1 sashelp work
class_1 c class_2 work work
class_2 c class_3 work work
class_3 c class_4 work work
class_3 d class_3 work work
;
%macro c(old=, new=, from=, to=); /* macro for copying a dataset */
data &to..&new;
set &from..&old;
run;
%mend c;
%macro d(dsn=, lib=); /* macro for delete a dataset */
proc datasets library=&lib nolist;
delete &dsn;
run;
%mend d;
%macro task(data=); /* working macro */
data _null_;
set &data;
if action = 'c' then do;
call execute('%c(old='||dsn||', new='||dsnn||', from='||in||', to='||out||')'); end;
if action = 'd' then call execute('%d(dsn='||dsn||', lib='||in||')');
run;
%mend task;
%task(data=data); /* run this macro */
|