BookmarkSubscribeRSS Feed
vxhong17
Calcite | Level 5
I need to merge data from the COMPUSTAT and CRSP (finance databases). The COMPUSTAT has data of firms from 1950 to now (I use annual version: annual data) and the CRSP has data of the stocks for firms in the COMPUSTAT from 1925 (monthly data).

I need data from 1925 to now. I merge two database using CUSIP (Committee on Uniform Securities Identification Procedures, a unique nine-character identification).

Because of some requirments from data, i need to merge databases from 1950 to now first and need to merge back to the data of the CRSP from 1925 to <1950

For example, I merge compustat and crsp data from 1950 to 2008 and have a file called merged1950 (monthly data)

I also have data of the CRSP from 1925 to 1949 called CRSP1925.

Variables of the CRSP from merged1950 and CRSP1925 are the same.However, there is no data of the COMPUSTAT in CRSP1925.

How can I merge two data, merged1950 and CRSP1925, to have a unique data with a name of finalmerge using only CUSIP.

Thanks for your suggestion,
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
since these two dataset are disjoint, you only need to stick the two datasets together.

DATA cuisp;
SET crsp1925 merged1950;
RUN;

This assumes the variables with the same content are named the same.
vxhong17
Calcite | Level 5
Doc@Duke
Thank you so much.

I wonder it works..
CRSP: 1925-2008
COMPUSTAT: 1950-2008

I merge CRSP and COMPUSTAT from 1950 to 2008 first and then merge the merged data back with CRSP 1925 to <1950.
Number of variables in the merged data > > number of variables in the CRSP. I accept the missing data for the COMPUSTAT from 1925-<1950.

Thanks

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 2 replies
  • 605 views
  • 0 likes
  • 2 in conversation