Hi Team,
I have two data sets, when i tried to joining two tables all the records are getting copied from right table except few date columns missing. after certain records its pasting.
Example below:-
Table :-
| Number | Closed | Sales rep |
| 96771 | 7/22/2020 0:00 | Madhu |
| 96768 | Radha | |
| 96771 | 7/21/2020 17:59 | Shankar |
| 90962 | 7/20/2020 17:59 | Madhu |
| 95527 | Radha | |
| 93647 | Shankar | |
| 96362 | 7/22/2020 17:59 | Madhu |
| 96361 | 7/20/2020 17:59 | Radha |
| 96339 | Shankar |
Table B
| Number | Closed | Supplies | Vendor |
| 96771 | 7/22/2020 17:59 | Ink | Abc |
| 96768 | 7/22/2020 17:59 | Pen | BCD |
| 96765 | 7/22/2020 17:59 | Printer | Abc |
| 96762 | 7/22/2020 17:59 | Ink | BCD |
| 96759 | 7/22/2020 17:59 | Pen | BD |
| 96756 | 7/22/2020 17:59 | Printer | CD |
| 96753 | 7/22/2020 17:59 | Ink | Abc |
| 96750 | 7/22/2020 17:59 | Pen | Abc |
| 96747 | 7/22/2020 17:59 | Printer | Bcd |
I need output like latest record based on closed column from table b as join to table A.
Show us the output you want.
proc sql;
create table want as
select b.*,a.Sales_rep
from
b b
left join
a a
on a.id= b.id;
quit;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.