1. What are Auto call Macro how to create them?
2. How to create Macro in Global symbol table within Macro parameter?
3. In a sas session i am having 5 libraries currently i have common dataset CITY (Dset name) i wnat to kill this dataset from all the libraries at once.As in future the no of lib may increase and decrease ased on that session.
4. Create a table from one library with all datasets with data.
Hi,
1) They are macro you use all the time, stored in a specific directory, and then used via options sasautos= option, e.g.
libname myautos "c:\myautos";
options sasautos=(myautos);
Just means you don't need to explicitly %include the files.
2) Not sure what you mean here, macros defined with %let, call symput etc. See the documentation on Scope:
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000206835.htm
3) Call execute or macro loop:
data _null_;
set sashelp.vlibnam (where=(substr(LIBNAME1,5)="MY_ID"));
/* Note I have assumed all libraries will be prefixed with MY_ID, change to your scenario */
call execute('proc datasets library='||strip(libname)||' nolist; delete city; quit;');
run;
4) Please clarify what you mean, do you just want new_libname to be a copy? Then:
libname NEW_DATA "...";
data _null_;
set sashelp.vtable (where=(libname="OLD_DATA"));
call execute('data NEW_DATA.'||strip(NAME)||'; set OLD_DATA.'||strip(NAME)||'; run;');
run;
1. SAS(R) 9.2 Macro Language: Reference
2. %global variablename;
3.:
data _null_;
do lib_name = 'lib1','lib2',....,'libn';
call execute("proc delete data=" !! strip(lib_name) !! ".city;run;");
end;
run;
Alternatively, you could store your libnames in a dataset and iterate through that.
4.:
proc sql;
select * from dictionary.tables where libname='libname';
quit;
One additional bit about autocall macros: the SAS filename has to match the name of the macro called and best is to only have the code for the macro plus comments in that file.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.