I wrote the following code :
proc sql;
create table new as
SELECT *
FROM A,B
where A.AID= B.BID ;
My output is almost as desired except the ones with missing values.
There are few observations in A where AID is missing and in final output
instead of getting the set of observations as it is, I am getting it repeated
n number of times. Could anybody please tell me the reason for the same.
Instead of entering zeros by hand, you could do
proc sql;
create table base_3 as
SELECT *
FROM A
LEFT JOIN B
ON coalesce(A.AID,0)= B.BID ;
quit;
(untested)
Instead of entering zeros by hand, you could do
proc sql;
create table base_3 as
SELECT *
FROM A
LEFT JOIN B
ON coalesce(A.AID,0)= B.BID ;
quit;
(untested)
It's your join type that causes the issue, just doing a left join should help, though they'd be blank, not 0
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.