Hello all,
can someone please help me to get the same output from SQL as i am getting from base SAS from the below code....????
data a;
input emp$ sal;
cards;
emp1 1000000
emp2 2000000
emp3 3000000
;run;
data b;
input emp$ sal;
cards;
emp1 1000000
emp3 7000000
emp4 4000000
;run;
data c;
update a b;
by emp;
run;
data c;
merge a(in=x) b(in=y);
by emp;
run;output should be like below:
---------------------
emp1 1000000
emp2 2000000
emp3 7000000
emp4 4000000
---------------------
Thanks and Regards
varmalh
proc sql;
select
coalesce(b.emp, a.emp) as emp,
coalesce(b.sal, a.sal) as sal
from a full outer join b on a.emp=b.emp;
quit;
@varmalh wrote:
Hello all,
can someone please help me to get the same output from SQL as i am getting from base SAS from the below code....????
data a; input emp$ sal; cards; emp1 1000000 emp2 2000000 emp3 3000000 ;run; data b; input emp$ sal; cards; emp1 1000000 emp3 7000000 emp4 4000000 ;run; data c; update a b; by emp; run; data c; merge a(in=x) b(in=y); by emp; run;output should be like below:
---------------------
emp1 1000000
emp2 2000000
emp3 7000000
emp4 4000000---------------------
Thanks and Regards
varmalh
proc sql;
select
coalesce(b.emp, a.emp) as emp,
coalesce(b.sal, a.sal) as sal
from a full outer join b on a.emp=b.emp;
quit;
@varmalh wrote:
Hello all,
can someone please help me to get the same output from SQL as i am getting from base SAS from the below code....????
data a; input emp$ sal; cards; emp1 1000000 emp2 2000000 emp3 3000000 ;run; data b; input emp$ sal; cards; emp1 1000000 emp3 7000000 emp4 4000000 ;run; data c; update a b; by emp; run; data c; merge a(in=x) b(in=y); by emp; run;output should be like below:
---------------------
emp1 1000000
emp2 2000000
emp3 7000000
emp4 4000000---------------------
Thanks and Regards
varmalh
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.