| Features: |
| Macro facility |
| DATASETS
procedure |
| PRINT procedure |
|
| Data set: |
EXPREV and
LIST
|
This example prints all the data sets in a SAS library. You can use
the same programming logic with any procedure. Just replace the PROC PRINT step near the end of the example with whatever procedure step you want to execute. The example uses the macro language. For
details about the macro language, see SAS Guide to Macro Processing, Version 6, Second Edition.
libname printlib 'SAS-data-library'
options nodate pageno=1 linesize=80 pagesize=60;
 | proc datasets library=work memtype=data nolist;
copy out=printlib;
select list exprev;
run;
|
 | %macro printall(libname,worklib=work);
|
 | %local num i;
|
 | proc datasets library=&libname memtype=data nodetails;
contents out=&worklib..temp1(keep=memname) data=_all_ noprint;
run;
|
 | data _null_;
set &worklib..temp1 end=final;
by memname notsorted;
if last.memname;
n+1;
call symput('ds'||left(put(n,8.)),trim(memname));
|
 | if final then call symput('num',put(n,8.));
|
 | run;
|
 | %do i=1 %to #
proc print data=&libname..&&ds&i noobs;
title "Data Set &libname..&&ds&i";
run;
%end;
%mend printall; |
 | options nodate pageno=1 linesize=70 pagesize=60;
%printall(printlib)
|
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.