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

I am trying to combine/collapse data to make it easier to run statistics on, but am having trouble on how to combine the data.

I was given billing data, and therefore patients can be billed multiple times for the same procedure using different billing codes.

I am trying to combine rows of data into a single row based on a patient's MRN and their date of surgery regardless of their billing codes (as I have recoded all the billing codes into bundles based on the procedure type).

 

i.e.

 

MRN      DOB       Date of Surgery    Procedure Code

12345    1/1/11    July 1, 2017          12345

12345    1/1/11    July 1, 2017          12345

67890    2/2/22    July 2, 2017          12345

67890   2/2/22     July 3, 2017           23456

45678   3/3/33     July 4, 2017           567890

45678   3/3/33     July 4, 2017           567890

45678   3/3/33     July 4, 2017           567890

 

 

In the above example, I woul want it to be collapsed to the following:

MRN      DOB       Date of Surgery    Procedure Code

12345    1/1/11    July 1, 2017          12345

67890    2/2/22    July 2, 2017          12345

67890   2/2/22     July 3, 2017           23456

45678   3/3/33     July 4, 2017           567890

 

I have tried the 

PROC MEANS NWAY;
  CLASS ;
  VAR ;
  OUTPUT OUT= MEAN= STD= N=;
RUN;

 But this did not work out.

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
TarunKumar
Pyrite | Level 9

 

TRY THIS CODE

 

proc sort data=have out=want nodup;by MRN;run;

View solution in original post

2 REPLIES 2
Reeza
Super User

Is that the PROC MEANS code you submitted? If not, please post the exact code. 

 

Look at PROC SORT with the NODUPKEY option. 

 

 

TarunKumar
Pyrite | Level 9

 

TRY THIS CODE

 

proc sort data=have out=want nodup;by MRN;run;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is Bayesian Analysis?

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.

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
  • 2 replies
  • 1004 views
  • 2 likes
  • 3 in conversation