PROC SQL Joins

Accepted Solution Solved
Reply
Super Contributor
Posts: 1,041
Accepted Solution

PROC SQL Joins

[ Edited ]

Hello Team,,

 

I have several left joins as shown and while joining i want to write a condition so unwanted records are not coming up in the final output.

I cant at the same time remove thoswe after the joins are made because then it might remove some of the records we want to keep

 

 

Proc sql;

create table want as

select *

from have as hv

left join table1 as tab1(where=var1 ne .))  on tab1.ID=hv.ID

left join...

left join....

where

quit;

run;


Accepted Solutions
Solution
‎09-09-2016 02:21 PM
Super User
Posts: 12,689

Re: PROC SQL Joins

Posted in reply to robertrao

Besides mismatched )

This part

left join table1 as tab1(where=var1 ne .))  

maybe should be

left join (select * from table1 where=var1 ne . ) as tab1   

View solution in original post


All Replies
Super User
Posts: 22,525

Re: PROC SQL Joins

Posted in reply to robertrao

Ok. You haven't provided enough details to understand what you're having issues with or what you need help with.

Please post sample input/output data as well as details of how you want your filter to work and why WHERE clauses or ON isn't working.

Esteemed Advisor
Posts: 5,335

Re: PROC SQL Joins

Posted in reply to robertrao

Is it just a syntax problem

 

Proc sql;
create table want as
select *
from 
	have as hv left join 
	table1(where=(var1 ne .)) as tab1 on tab1.ID=hv.ID left join...
where ...;
quit;

  

PG
Solution
‎09-09-2016 02:21 PM
Super User
Posts: 12,689

Re: PROC SQL Joins

Posted in reply to robertrao

Besides mismatched )

This part

left join table1 as tab1(where=var1 ne .))  

maybe should be

left join (select * from table1 where=var1 ne . ) as tab1   

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 331 views
  • 2 likes
  • 4 in conversation