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

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;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

3 REPLIES 3
Reeza
Super User

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.

PGStats
Opal | Level 21

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
ballardw
Super User

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   

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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