data females males;
set apple.survey;
if Gender = "F" then output females;
else if Gender = "M" then output males;
run;
proc print data = females;
run;
proc print data = males;
run;
To
Do not split, rather sort and print to make it look multiple groups i.e
proc sort data=apple.survey out=want;
by gender;
run;
proc print data =want;
run;
If you go this route, you can add to the PROC PRINT step:
proc print data=want uniform;
by gender;
pageby gender;
run;
Thank you @Astounding I learned something new viz. uniform option. Nice!
thank you , but it does not work
Thank you , but it doesn't work .
@tianerhu wrote:
How to print Multiple datasets in one proc print statement?
data females males; set apple.survey; if Gender = "F" then output females; else if Gender = "M" then output males; run; proc print data = females; run; proc print data = males; run;
So the answer has already been given above, but there is no reason whatsoever to split the data set into two in the first place, and then do the same thing on both splits. Usually this is very poor practice.
Thank you , but it doesn't work .
PROC PRINT cannot print multiple data sets at once. If you have groups within your data, the SAS method for analysis is optimal when you do not split your data set into multiple data sets. Then you can use BY group processing. However, if you have split your data then you need to call PROC PRINT multiple times. This is a design choice, which is yours as the programmer.
thank you .
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.