Hello
I want to merge 2 data sets by char vars.
This example is working well but in real world when I do it I don't succeed. merge the 2 tables well
The field I want to add has null values (in real world)
Why???
data abc1;
infile datalines dlm=',';
length x1 $11 x2 $6 ;
input x1 $ x2 $ ;
cards;
AGE_1_VALUE,YESHUT
;
Run;
data abc2;
infile datalines dlm=',';
length x1 $11 x2 $6 x3 $10.;
input x1 $ x2 $ x3 $ ;
cards;
AGE_1_VALUE,YESHUT,continuous
;
Run;
proc sql;
create table want as
select a.*,b.x3
from abc1 as a
left join abc2 as b
on compress(upcase(a.x1))=compress(upcase(b.x1)) and compress(upcase(a.x2))=compress(upcase(b.x2))
;
quit;
Explain in detail what you mean by "don't succeed". Does it throw an ERROR/WARNING or is the result not what you expect?
Anyway, provide examples of the data where this happens.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.