data CRSP_new;
set CRSP1;
year = YEAR(date);
run;
proc sql;
create table crspcomp as
select a.* , b.*
from cstatcusip1 a
inner join CRSP_new b
on a.cusip8 = b.cusip and a.fyear= b.year;
quit;
I used this code. It worked well! awesome!
Well... now I noticed that the Date on original CRSP file changed to the same dates of Compustat file(To be more specific, they become like certain-patterned numbers. and I changed these by resetting formats to YYMMDDN8.) Since Compustat dates are mostly year-end, I have many duplicated 12/31 days. For example 2011/10/13 -> 2011/12/31.
It looks that because of this code; year = YEAR(date);
I thought the year converted only used for matching and original CRSP dates should remain.
Also, I saw a warning sign when clicking 'submit' that there is already 'date' variables in crspcomp(newly created one by merge)
.
I thought that is as there is only one 'date' variable in two sets so there will be only one 'date' variable after merge too. I already check my Compustat file where the name of the date variable is 'datadate' so no two 'date' variables.
Please share your ideas and wisdom how I keep CRSP date after merging.
I truly sincerely appreciate all help from all of you!!!
Jerry
Hello,
the code itself is fine!!!
BUT REMEMBER there is no same variable NAME in your files. That was my silly mistakes!
Hello,
the code itself is fine!!!
BUT REMEMBER there is no same variable NAME in your files. That was my silly mistakes!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.