Help using Base SAS procedures

Merge data

Reply
Contributor
Posts: 51

Merge data

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,
Trusted Advisor
Posts: 2,113

Re: Merge data

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.
Contributor
Posts: 51

Re: Merge data

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
Ask a Question
Discussion stats
  • 2 replies
  • 134 views
  • 0 likes
  • 2 in conversation