In the following simulation the data set contains 1000 stocks with transactions from Jan 1, 1980 to Jan 1, 2014. The total obersavtions are over 12,000,000.
Real time ~2.40 + 6.21 seconds
CPU time ~ 8.59 + 14.13 seconds
*****************log**************;
200
201 proc means data=stock p10 p90 noprint;
202 var volume;
203 output out=pctl p10=p10 p90=p90;
204 run;
NOTE: There were 12432420 observations read from the data set WORK.STOCK.
NOTE: The data set WORK.PCTL has 1 observations and 4 variables.
NOTE: PROCEDURE MEANS used (Total process time):
real time 2.40 seconds
cpu time 8.59 seconds
205
206 data pctl_fmt;
207 set pctl;
208 length start $20.;
209 fmtname='group';
210 start='low' ; end=put(p10,best.); label=1;output;
211 start=put(p10,best.); ; end=put(p90,best.); label=2;output;
212 start=put(p90,best.); ; end='high'; label=3;output;
213
214 run;
NOTE: There were 1 observations read from the data set WORK.PCTL.
NOTE: The data set WORK.PCTL_FMT has 3 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
215
216 proc format cntlin=pctl_fmt;
NOTE: Format GROUP is already on the library WORK.FORMATS.
NOTE: Format GROUP has been output.
217 run;
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: There were 3 observations read from the data set WORK.PCTL_FMT.
218
219 data stock_view/view=stock_view;
220 set stock;
221 group=put(volume,group.);
222 run;
NOTE: DATA STEP view saved on file WORK.STOCK_VIEW.
NOTE: A stored DATA STEP view cannot run under a different operating system.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
223
224 proc means data=stock_view n sum noprint;
225 class code group ;
226 var volume;
227 output out=sum n=count sum=sum_volume;
228 run;
NOTE: View WORK.STOCK_VIEW.VIEW used (Total process time):
real time 6.21 seconds
cpu time 14.13 seconds
NOTE: There were 12432420 observations read from the data set WORK.STOCK.
NOTE: There were 12432420 observations read from the data set WORK.STOCK_VIEW.
NOTE: The data set WORK.SUM has 4008 observations and 6 variables.
NOTE: PROCEDURE MEANS used (Total process time):
real time 6.22 seconds
cpu time 14.13 seconds
***********************************************************;
data stock;
do date='1jan1980'd to '1jan2014'd;
do code=1000 to 2000;
volume=ceil(ranuni(123)*10000);
output;
end;
end;
run;
proc print data=stock(obs=10);
run;
proc means data=stock p10 p90 noprint;
var volume;
output out=pctl p10=p10 p90=p90;
run;
data pctl_fmt;
set pctl;
length start $20.;
fmtname='group';
start='low' ; end=put(p10,best.); label=1;output;
start=put(p10,best.); ; end=put(p90,best.); label=2;output;
start=put(p90,best.); ; end='high'; label=3;output;
run;
proc format cntlin=pctl_fmt;
run;
data stock_view/view=stock_view;
set stock;
group=put(volume,group.);
run;
proc means data=stock_view n sum noprint;
class code group ;
var volume;
output out=sum n=count sum=sum_volume;
run;
proc print data=sum;run;