Merging datasets based on 2 variables in SAS.
- by John
Hye Guys,
my question is the following, i'm working with different databases, all contain information about 1000+ companies, a company is defined by its ticker code (the short version of the name( Ford as F) usually seen on stock quotation boards). Aside from the ticker code to merge on I also have to merge on the time, I used month as a count variable throughout my time series. The final purpose is to have a regression in the kind of
Y(jt) = c + X(jt) +X1(jt) etc with j = company (ticker) and t = time (month).
So imagine I have 2 databases, one which is the base database with variables such as Tickers, months, beta's of a company (risk measure) etc and a second database which has an extra variable (let's say market capitalisation). What I want to do then is to merge these 2 databases based on the ticker and the month.
Example: Base database:
Ticker __ Month __ Betas
AA __ 4 __ 1.2
BB __ 8 __ 1.18
Second database:
Ticker __ Month __ MCAP
AA __ 4 __ 8542
BB __ 6 __ 1245
Then after merge I would like to have something like this:
Ticker __ Month _ Betas ___ MCAP
AA __ 4 _ 1.2 ___ 8542
So all observations that do not match BOTH date and ticker have to be dropped, I'm sure this is possible, just can't find the right type of code.
Thanks!
PS: I'm guessing the underscars have something to do with font layout but both the bold as italic is supposed to be normal :)