BookmarkSubscribeRSS Feed
noobs
Calcite | Level 5

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
Calcite | Level 5

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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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