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

Hi Instructurs,

 

I have a table work.RL_INFO

 

INDV_KEY PROF_REF_NO MEMBER_ID USER_ID OTH_ID NM_TX BRTH_DT SUBJ_INDV_KEY TO_INDV_KEY RLTN_TX RLTN_STRT_DT RLTN_END_DT
651475EF7 651475EF7F8B     S93 ABB 7-Jul-93 2742A6C99A4296324EFF2017 651475EF7F8BC23D80063C Member 7-Jul-93 .
651475EF8 651475EF7F8B     S93 ACC 10-Jul-93 2742A6C99A4296324EFF2018 651475EF7F8BC23D80064C      

 

I wrote a query,

 

proc sql; 
	create table RL as 
	select distinct
        RLTN_TX as Rel 
		,MEMBER_ID
		,USER_ID
,BRTH_DT from WORK.RL_INFO WHERE MEMBER_ID=&INPUTID. or USER_ID=&INPUTID. or OTH_ID =&INPUTID. group by Rel HAVING RelEndDT = MAX(RelEndDT) ;quit;

 

 

It was designed where eithter MEMBER_ID , USER_IDOTH_ID can be treated as input variable &INPUTID. for query the Rel information. However, when If encounger a duplicated OTH_ID, then I need a additional information BRTH_DT as a mandatory input &INPUTDOB. to locate that subject.

I want the first row in my table work.RL_INFO be the out put for sql table RL.

 

I've tried to change where clause to,

WHERE MEMBER_ID=&INPUTID. or USER_ID=&INPUTID. or OTH_ID =&INPUTID. or BRTH_DT=&INPUTDOB.

It didn't work.

How do I do that?

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

Changing the last OR to AND should be closer to what you expect.

View solution in original post

2 REPLIES 2
andreas_lds
Jade | Level 19

Changing the last OR to AND should be closer to what you expect.

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