BookmarkSubscribeRSS Feed
Ramsha
Obsidian | Level 7

I have created a new table out of two datasets using left join. However since some of the format is incorrect in dataset 2, there are some missing values in the joined new table. I know which values to add but I am stuck on the syntax. How do I add on to the missing values in this code? Do I make a seperate proc sql? or do I use if/else statements? If it is something like if/else, where would I put them? If it is a different concept, please let me know. Feel free to use the sample code from my work below or simplify it to whatever you would use. Thank you!

 

proc sql;
create table final as
select L.*, R.*
from A as L
left join B as R
on (substr(L.One, length(L.One)-1)=substr(R.Two,length(R.Two)-1)
and substr(L.State, length(L.State)-1)) ;
quit;

proc print data = final;
run;

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

Why did you create new thread?

Since the 2 questions are still unanswered, you won't get much help. 

Please make an effort to explain the final output properly:

Provide example data and expected output and processing logic you want implemented.

 

Marking this as spam to avoid duplicates.

Please use the original thread .

 

 

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 894 views
  • 0 likes
  • 2 in conversation