Hi, guys I need your help again. I am trying to merge two database.One includes firms with bond downgradings, firm id and the date when they got downgraded. The other is a huge database with all North American firms' daily stock return . I would like to add stock returns during a 7-day window( 3 trading days before and 3 trading days after the date of the downgrade) for these downgraded firms to table1 . Basicly, each observation on table1 will become 7 observatios. If I only need the date of downgrade, I can use sql merger like this: proc sql; create table merged as select a.*, b.* from table1 as a left join table2 as b on a.lpermno=b.lpermno and a.rating_date=b.date; Above procedures will only include one date. Also, date on table2 is not canlendar day, there may be missing dates due to the close of stock market on weekend or holiday so it is possible that the date of downgrading might occur on the date when the market was not traded (that is, a date is not on table 2, but in table 1). I attached two tables. My actual table2 is as large as 2GB. Thanks.
... View more