e****o 发帖数: 690 | 1 data input;
seed = 1245;
do id = 10000 to 99009 by 52;
do year = 2001 to 2008;
do i = 1 to 300 ;
return = abs(34.45 + rannor(seed*4)*5)/100 - rannor(seed*100)/5.05;;
if id < 50000 then datadate = mdy(12, 31, year) ; else datadate = mdy(6, 30
, year);
trade_date = datadate + i ;
output ;end; end; end;
drop seed i;
format datadate trade_date date9. ;
run ;
proc sort data = input; by permno trade_date ; run ;
%macro daily_return;
proc expand data = input out = i2 ;
id trade_date ;
by id ;
%do i = 1 %to 252 ;
convert return = return_day&i / transformout = (lag &i) ;
%end;
run ;
%mend;
%daily_return ;
My purpose is to :
ret1 = first day raw return in the year
ret2 = second day raw return in the year
ret3 = third day raw return in the year
**************
ret251 = 251th day raw return in the year
ret252 = 252th day raw return in the year |
|