- proc sort data=stocks;
- by date time;
- run;
- data daydata;
- set stocks;
- by date;
- retain O C H L:
- if first.date then do;
- O=price;
- H=price;
- L=price;
- end;
- if H<price then H=price;
- if L>price then L=price;
- if last.date then do;
- C=price;
- output;
- end;
- run;