BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JKCho
Pyrite | Level 9

 

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
JKCho
Pyrite | Level 9

Hello,

 

the code itself is fine!!!

 

BUT REMEMBER there is no same variable NAME in your files. That was my silly mistakes!

View solution in original post

4 REPLIES 4
JKCho
Pyrite | Level 9
Oh... I cannot remove this post. NEVER MIND. I found what was an issue. Sorry all of you
Reeza
Super User
I would recommend posting the solution and then marking it as the answer?
JKCho
Pyrite | Level 9
Agree and I did!
JKCho
Pyrite | Level 9

Hello,

 

the code itself is fine!!!

 

BUT REMEMBER there is no same variable NAME in your files. That was my silly mistakes!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1167 views
  • 0 likes
  • 2 in conversation