BookmarkSubscribeRSS Feed
juliajulia
Obsidian | Level 7

hello,

 

I have a data set with variables: clientID, ProviderID, and servicesID. like this:

clientID ProviderID ServiceID

1           2                8

1           2                4

1           3                8

1           3                2

1           4                1

 

I want to create a summarized data set per client and per provider . the final table should like this:

clientID ProviderID

1           2               

1           3               

1           4           

 

I used the following sas code but I don't know it is not working:

 

proc sql ;

create table test as

select clientid, providerid

from xx

group by clientid, providerid;

quit;

3 REPLIES 3
novinosrin
Tourmaline | Level 20

Hello @juliajulia 

 

Are you asking for

proc sql ;

create table test as

select distinct clientid, providerid

from xx;

quit;

PaigeMiller
Diamond | Level 26

Your desired output looks like you just want to find the distinct combinations of CLIENTID and PROVIDERID, and this ignores SERVICEID. Is that what you want? That doesn't usually fit what I think of when I hear the word "summarize". Can you clarify this?

 

If that's what you want, then

 

proc sql;
    create table want as select distinct clientid,providerid from xx;
quit;
--
Paige Miller
juliajulia
Obsidian | Level 7
Yes, when I add the distinct statement, it’s come out with the result I want.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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