Last active
August 29, 2015 14:10
-
-
Save joosti/5e1c20df74dbba6b2d17 to your computer and use it in GitHub Desktop.
SAS proc datasets macros
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| libInfo - info on datasets in library | |
| libInfo (lib=, dset=, attr=, eng=, vars=) | |
| lib: library, default is work | |
| dset: dataset, default is _all_ | |
| attr: output dataset with attributes, default is work.attr | |
| eng: output dataset with engine, default is work.eng | |
| vars: output dataset with variables, default is work.vars | |
| sample usage: %libInfo(lib=crsp, dset=CCMXPF_LINKTABLE); | |
| */ | |
| %macro libInfo(lib=work, dset=_all_, attr=attr, eng=eng, vars=vars); | |
| ods listing close; | |
| ods output | |
| attributes = &attr | |
| enginehost = &eng | |
| variables = &vars; | |
| proc datasets lib = &lib; contents data=&dset ; quit;run; | |
| ods output close; | |
| ods listing; | |
| %mend; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| rm: removes datasets | |
| rm (dsets=, lib=) -- removes dsets in library lib | |
| dsets: datasets to remove | |
| lib: library, default is work | |
| sample usage: %rm(attr eng); * deletes attr and eng from lib work | |
| */ | |
| %macro rm(dsets, lib=work); | |
| proc datasets library=&lib; | |
| delete &dsets; | |
| quit;run; | |
| %mend; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment