BookmarkSubscribeRSS Feed
noobs
Fluorite | Level 6

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

3 REPLIES 3
Astounding
PROC Star

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.

noobs
Fluorite | Level 6

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?

Astounding
PROC Star

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.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 8042 views
  • 4 likes
  • 2 in conversation