Hi, expert.
Thanks for your help, but that code doesn't work.
I type the code and example below to provide information.
data event;
input code $ date yymmdd10.;
format date yymmdd10.;
cards;
001 2010-01-04
002 2015-03-21
;
run;
data prc;
input code $ date yymmdd10. prc;
format date yymmdd10.;
cards;
001 2010-01-01 9
001 2010-01-02 11
001 2010-01-03 10
001 2010-01-05 11
001 2010-01-06 12
002 2015-03-17 5
002 2015-03-19 4
002 2015-03-21 5
002 2015-03-22 6
;
run;
data want;
input code $ date yymmdd10. prc prc_3daysago;
format date yymmdd10.;
cards;
001 2010-01-04 10 9
002 2015-03-21 5 5
;
run;
1) Since there are holidays in the stock market,
the stock price on the event day is the stock price on the event day or the most recent stock price before the event day.
2) I also need the stock price three days before the event,
the same logic uses the stock price on that day or the most recent one.
3) In this case, is it easier to use proc sql?
Or can it be done with set/retain/merge?
Very appreciate for your help.
Looking forward to your reply.
... View more