BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ybz12003
Rhodochrosite | Level 12

Hi all,

 

I would like to print out a report by grouping studysites for a dataset 'test'.   I have a code below.  However, I found out that the output file was order by studysite, it print out the studysite and the IDs one by one.   I don't like that, I would like to out put the file with grouping the studysite first, then sorting the IDs later.  I found there is no 'GROUP' option in the PROC PRINT,  please advice how to approach it?  Thanks.

 

options orientation=portrait;
proc print data=test;
	var id repeat_id studysite DOB months days;
	where repeat_id in (&replistdob.);
	by studysite repeat_id;
	title 'More than 1 dob for a repeat ID';
run;
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

I would like to out put the file with grouping the studysite first, then sorting the IDs later.


use by studysite; instead of by studysite repeat_id;

 

 

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

I would like to out put the file with grouping the studysite first, then sorting the IDs later.


use by studysite; instead of by studysite repeat_id;

 

 

--
Paige Miller
ybz12003
Rhodochrosite | Level 12
Thanks!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 2 replies
  • 586 views
  • 0 likes
  • 2 in conversation