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

I have the following proc sql and output below.  I am trying to solve for remove duplicates by pulling in the INDV_CHNL_PTNR_ID with the MAX (Cert_Ranking). The Cert_Ranking column comes from a case statement I created in the original table. The having clause I am using is not working. Does anyone have any suggestions? 

proc sql; create table test as
select distinct 
* 
from MedicareSalesAgencies
having max(Cert_Ranking) and indv_chnl_ptnr_id
; quit;

 

INDV_CHNL_PTNR_ID Cert_Ranking
29 11
29 3
29 2
29 11
29 3
29 2
29 11
29 3
29 2
29 11
29 3
29 2
34 3
34 2
34 3
34 2
34 3
34 2
34 3
34 2
34 3
34 2
34 3
34 2
34 3
34 2
34 3
34 2

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
proc sql; create table test as
select 
indv_CHNL_PTNR_ID, max(CERT_RANKING) as CERT_RANKING
from MedicareSalesAgencies
group by indv_CHNL_PTNR_ID
; quit;

Does that give you what you expect? If not, please post the desired outcome and we can help with the query. 

View solution in original post

2 REPLIES 2
Reeza
Super User
proc sql; create table test as
select 
indv_CHNL_PTNR_ID, max(CERT_RANKING) as CERT_RANKING
from MedicareSalesAgencies
group by indv_CHNL_PTNR_ID
; quit;

Does that give you what you expect? If not, please post the desired outcome and we can help with the query. 

LMSSAS
Quartz | Level 8

That gives me the desired outcome, Thank you!

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