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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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