09-04-2014 04:41 AM
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.
09-04-2014 04:58 AM
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";
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:
3) Call execute or macro loop:
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;');
4) Please clarify what you mean, do you just want new_libname to be a copy? Then:
libname NEW_DATA "...";
set sashelp.vtable (where=(libname="OLD_DATA"));
call execute('data NEW_DATA.'||strip(NAME)||'; set OLD_DATA.'||strip(NAME)||'; run;');
09-04-2014 05:09 AM
2. %global variablename;
do lib_name = 'lib1','lib2',....,'libn';
call execute("proc delete data=" !! strip(lib_name) !! ".city;run;");
Alternatively, you could store your libnames in a dataset and iterate through that.
select * from dictionary.tables where libname='libname';