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!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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