Printing multiple datasets in a go

Reply
Contributor
Posts: 73

Printing multiple datasets in a go

Hello Enterprise Guide Users:

IS anyone aware of a way to print more than one dataset in single proc PRINT?

SAS Program:

proc print data=sesug.actids sesug.actidshld;

run;

LOG Window:

proc print data=sesug.actids, sesug.actidshld ;

                                       _

                                       22

                                       200

ERROR 22-322: Syntax error, expecting one of the following: ;, (, BLANKLINE, DATA, DOUBLE, HEADING, LABEL, N, NOOBS, OBS, ROUND,

              ROWS, SPLIT, STYLE, SUMLABEL, UNIFORM, WIDTH. 

ERROR 200-322: The symbol is not recognized and will be ignored.

19         run;

I have tried using comma between the two datasets like so:

proc print data=sesug.actids, sesug.actidshld;

run;

However it was in vain. So curious if I am missing something very basic?

Thank you,

Dhanashree Gadkari

Super User
Posts: 5,084

Re: Printing multiple datasets in a go

PROC PRINT will only let you print a single data set at a time.  However, IF both data sets have the same structure, you could try defining a VIEW to combine them:

data combine / view=combine;

   set sesug.actids sesug.actidshld;

run;

proc print data=combine;

run;

Good luck.

Contributor
Posts: 73

Re: Printing multiple datasets in a go

Ok, good to know about this constraint of proc PRINT.

Note structure of the two data sets is different, so using concatenation, even with help of rename= option sounds stretching it further. And since I am avoiding to create another extra data set to just examine and compare the values, I might have to pass on this solution.

May I ask assuming the structure was same, does your suggested solution increase the length (number of observations) of combined data set or results in wider data set.

Thank you for introducing VIEW= option for data statements. Is this option used to create view similar to that in SQL? not generating physical sas data file?

Super User
Posts: 5,084

Re: Printing multiple datasets in a go

If the structure is identical, then the view would generate a longer report (number of observations) with the same width.  Once the structure is different, the result becomes wider with mismatched variables having missing values.  So you're right, this approach wouldn't help when the structure is different.

Views are identical no matter how they are created within SAS, containing the instructions but not the data.  A DATA step and PROC SQL are probably the most common methods ... I believe there are a total of 4 possible methods altogether.  As always, views should usually be reserved for one-time use, since they have to extract the data each time they are used.

Ask a Question
Discussion stats
  • 3 replies
  • 445 views
  • 4 likes
  • 2 in conversation