Help using Base SAS procedures

Printing 20 Datasets in a same library

Regular Contributor
Posts: 229

Printing 20 Datasets in a same library

In a library (Ex-Work). i have 20 Datasets .now i want to print all the datasets in that library at once. Message was edited by: Michel_SAS
Posts: 61

Re: Printing 20 Datasets in a same library

Hi Michel.,

If u want all the 20 data sets in a single dataset do as follows

data test;
set sashelp.column
proc print;

and if u want to 20 datasets in a permanent library and assign a library.
Super User
Posts: 5,257

Re: Printing 20 Datasets in a same library

But if your tables don't have the same lay-out, you may wish to print them independently (but in the same program). You can use call execute from a data step that reads SASHELP.VMEMBER for instance.

Data never sleeps
Posts: 8,743

Re: Printing 20 Datasets in a same library

A clarification. The name of the data set is DICTIONARY.MEMBERS if you're using SQL and SASHELP.VTABLE or VSTABLE if you're using a DATA step program. Building CALL EXECUTE statements will happen in 1 DATA step program, that's true. However, the statements (PROC PRINTS) that are built do not represent 1 program, but a series of 20 PROC PRINT programs or steps that are put into a program queue. The 1 program that builds the CALL EXECUTE statements will run, then the 20 PROC PRINTS will run, AFTER the entire DATA step has finished building all the CALL EXECUTE statments.

There is an example of using CALL EXECUTE to build program code here:䊵
You would not need the conditional logic in that program.

Instead, you would search SASHELP views of the DICTIONARY tables and build your PROC PRINTS as illustrated. More information on SASHELP and DICTIONARY processing is described here:

Posts: 0

Re: Printing 20 Datasets in a same library



How would your printer cope with 20 datasets to print "at once"?

it wouldn't!
It would print one at a time
unless, perhaps, you have 20 printers, but I don't expect so.

Much more likely ~ I expect you want 20 print files, or perhaps 20 worksheets in an excel workbook?

Even thought there is a PROC CONTENTS feature that conveniently reports on the structure of _all_ data sets in a SAS library, there is no corresponding feature of PROC PRINT to print the contents of all data sets in a library.
I like the possibility of drag-n-drop support in SAS Enterprise Guide (SEG) providing a quick delivery of multiple data sets into excel or some other output destination, but since SEG is not my field of expertise I can only recommend you pose your question on that forum at .

In the "SAS Macro Facility, Data Step and SAS Language Elements" umbrella forum at enthusiasts might package the printing of multiple data sets into a macro of some sort to achieve what you seek.

Even if SEG functionality supports your objective of conveniently "printing" all data sets at "once", I wouldn't refer to it as being achieved "at once" by a SAS Procedure
. ( so, sorry, wrong forum Smiley Happy.

Peter C
Ask a Question
Discussion stats
  • 4 replies
  • 5 in conversation