The SAS Output Delivery System and reporting techniques

left join is not working...

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 80
Accepted Solution

left join is not working...

.   Hi I have 2  tables  one  has 7k.   Records table 2 has 14k

 

i want  to bring every thing from table one 7k records and only the data from table 2 matches...enclose is my  code

 

proc sql;

create table temp2 as

select one.*, two.atm as b_atm, two.date as b_date

from one,two

where one.id=two.id and two.date gt  one.date

group by one.id

having two.date-one.date =min(two.date-one.date);

 

create table want2 as 

select temp2.*,two.id as c_id ,two.date as c_date 

From temp2,two 

 

where  temp2.id =two.id and two.date  gt temp2.date

group by temp2.id

having two.date- temp2.date=min(two.date-temp2.date);

quit;

 

thanks for assistance 


Accepted Solutions
Solution
‎05-27-2016 11:06 PM
Contributor
Posts: 59

Re: left join is not working...

Hi Beto16,
Your title says "left join is not working" but I do not see a left join in your code. It is all inner join. Can you be more specific as to what you are getting and what you want to get?
Michelle

View solution in original post


All Replies
Solution
‎05-27-2016 11:06 PM
Contributor
Posts: 59

Re: left join is not working...

Hi Beto16,
Your title says "left join is not working" but I do not see a left join in your code. It is all inner join. Can you be more specific as to what you are getting and what you want to get?
Michelle
Frequent Contributor
Posts: 80

Re: left join is not working...

Sorry YOUR Right ..I Must Have Pasted Wrong Code
Post a Question
Discussion Stats
  • 2 replies
  • 381 views
  • 1 like
  • 2 in conversation