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-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
  • 1 reply
  • 482 views
  • 0 likes
  • 2 in conversation