Easy. data have;
input DATE : yymmdd8. PRC ;
format date yymmddn.;
cards;
19891229 46.25000
19900131 42.00000
19900228 44.50000
19900330 38.75000
19900430 38.00000
19900531 38.75000
19900629 37.50000
19900731 35.87500
19900831 32.62500
19900928 21.37500
19901031 17.25000
19901130 24.00000
19901231 22.87500
19910131 28.12500
19910228 29.25000
19910328 34.62500
19910430 36.87500
19910531 42.12500
19910628 35.75000
19910731 34.75000
19910830 38.62500
19910930 35.62500
19911031 37.37500
19911129 34.37500
19911231 40.62500
19920131 43.87500
19920228 47.50000
19920331 45.50000
19920430 47.75000
19920529 46.50000
19920630 47.62500
19920731 46.00000
19920831 42.87500
19920930 44.37500
19921030 46.25000
19921130 50.37500
19921231 51.37500
19930129 53.75000
19930226 53.50000
19930331 54.62500
19930430 49.62500
19930528 47.12500
19930630 49.62500
19930730 50.37500
19930831 51.50000
19930930 51.50000
19931029 46.62500
19931130 47.12500
19931231 49.00000
;
run;
data quarter semi_year a_year ;
set have;
month=month(date);
if month in (3 6 9 12) then output quarter;
if month in (6 12) then output semi_year;
if month eq 12 then output a_year;
run;
data quarter;
set quarter;
ratio=lag(prc)/prc - 1 ;
run;
Ksharp Message was edited by: xia keshan
... View more