[code:37vum4h3]data a;
input stock_code date yymmdd8. ret;
format date yymmddn8.;
cards;
1 20030405 0.01
1 20040406 0.03
1 20040503 0.025
2 20010407 0.013
2 20020101 0.015
run;
proc sql;
create table aa as
select *,(max(date)-min(date)) as date_diff
from a
group by stock_code;
quit;[/code:37vum4h3]