BookmarkSubscribeRSS Feed
dan1775
Calcite | Level 5

Hello,

New SAS user here.

I have a data set of medical enrollment that shows the member id, their primary care provider, and the to and from dates that the member was enrolled with that provider, thus:

member_id      pcp_id      from_date      to_date

12345              ABCD      MMYYDD1     MMYYDD2

12345              EFGH      MMYYDD3     MMYYDD4

67890              WXYZ      MMYYDD5     MMYYDD6

The issue is that I want output like this:

member_id      pcp_id1      from_date1      to_date1         pcp_id2      from_date2      to_date2

12345              ABCD      MMYYDD1     MMYYDD2        EFGH        MMYYDD3     MMYYDD4

67890              WXYZ      MMYYDD5     MMYYDD6

So, in English I want to have a single record for each member, that lists all that members PCPs and the corresponding dates.  I've done my research, but nothing I try works.  I've actually used an array to go the other way on this operation, although only with a single variable.

Any help would be appreciated.

1 REPLY 1
Linlin
Lapis Lazuli | Level 10

proc summary nway data=your_dataset missing;                         

   class member_ID;                                           

   output                                                    

      out = work.wide(drop=_type_ _freq_)                    

      idgroup(out[2](pcp_id from_date do_date)=)                    

     ;

run;

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
  • 1 reply
  • 541 views
  • 0 likes
  • 2 in conversation