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: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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