06-11-2013 10:41 AM
Hello Enterprise Guide Users:
IS anyone aware of a way to print more than one dataset in single proc PRINT?
proc print data=sesug.actids sesug.actidshld;
proc print data=sesug.actids, sesug.actidshld ;
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.
I have tried using comma between the two datasets like so:
proc print data=sesug.actids, sesug.actidshld;
However it was in vain. So curious if I am missing something very basic?
06-11-2013 12:46 PM
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;
proc print data=combine;
06-11-2013 04:31 PM
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?
06-11-2013 04:52 PM
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.