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

I have Medicaid data, and there is a separate line for the category of each diagnosis (DX_cat) given at a visit to a doctor.  I want to combine all of those diagnoses into a single line for each visit.  Keep in mind that this requires combining with respect to ID (Encrpt_ID) AND date of service (ClaimDOS).  I've found various methods to combine with respect to a single variable, but none for multiple variables.  I'm guessing that SQL would be best for this, but I'm open to whatever works.  I believe that the number of diagnoses that can be given at a single visit is limited to 9.

The input data looks like this:

Encrpt_IDClaimDOSDX_cat
123

1-10-14

2
1231-10-145
1232-1-142
1232-1-145
1232-1-146
4561-10-147
4561-10-1410
7896-1-141

The output should look like this:

Encrpt_IDClaimDOSDX_cat_1DX_cat_2DX_cat_3
1231-10-1425
1232-1-14256
4561-10-14710
7896-1-141
1 ACCEPTED SOLUTION

Accepted Solutions
stat_sas
Ammonite | Level 13

proc transpose data=have out=want prefix=DX_cat_;

  by Encrpt_ID ClaimDOS notsorted;

  var DX_cat;

run;

View solution in original post

2 REPLIES 2
stat_sas
Ammonite | Level 13

proc transpose data=have out=want prefix=DX_cat_;

  by Encrpt_ID ClaimDOS notsorted;

  var DX_cat;

run;

Wolverine
Quartz | Level 8

That works nicely -- thank you!  :smileygrin:

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!

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