Here is my code below. It appears that the two files join but only the Column headings show from the second dataset. I'm also attaching a screen shot of the "joined" file. I'm using SAS 9.4. Thanks
proc sql undo_policy = none;
create table FinalBharReg as select
a.*, b.*
from fundaBETABhar a left join ControlsBhar b
on a.gvkey= b.gvkey2 and a.datadate= b.datadate2;
quit;
No screenshot was attached.
That usually happens when your join condition is wrong and you have no matches, so everything shows up as missing.
Check the fields you're joining and see if they match exactly or if you need to change something. For example if its a character variable, are they both the same lengths.
Also make sure to check the log.
@manleygurl wrote:
Here is my code below. It appears that the two files join but only the Column headings show from the second dataset. I'm also attaching a screen shot of the "joined" file. I'm using SAS 9.4. Thanks
proc sql undo_policy = none;
create table FinalBharReg as select
a.*, b.*
from fundaBETABhar a left join ControlsBhar b
on a.gvkey= b.gvkey2 and a.datadate= b.datadate2;
quit;
It means that the condition
gvkey= b.gvkey2 and a.datadate= b.datadate2
is never met. If you replace left join by inner join, the output table should be empty.
One of many possible reasons for this would be that the dates have different representations in both tables.
thank you
"Columns headings" meaning columns, or?
If your tables have the same columns names, yes, they will overwrite (since you are using *) - but you should get a notification in the log if that's the case.
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 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.