/***************************************************************************************************************** SAS file name: BufCaseStudy File location: _________________________________________________________________________________________________________________ Purpose: To demonstrate the performance impact of the BUFNO and BUFSIZE data set buffer options. Author: Peter Clemmensen Creation Date: 18/06/2018 This program supports the example page "A SAS Case Study of the BUFSIZE and BUFO Options" on SASnrd.com *****************************************************************************************************************/ options fullstimer; options msglevel=i; options nonotes nosource; proc printto log="c:\Users\Peter\Desktop\MyLog.log"; run; options notes source; %passinfo; data callstack; length string $500; do bufsize=0, 4, 8, 16, 32, 64, 128, 256, 512; do bufno=1, 2, 5, 10, 20, 50, 100, 200, 500; string=compbl(cats( " data a(bufsize=", bufsize, "k bufno=", bufno, "); length string $1000; do x=1 to 10e5; output; end; run; data b(bufsize=", bufsize, "k bufno=", bufno, "); set a; run; " )); output; call execute(string); end; end; run; proc printto; run; %logparse(c:\Users\Peter\Desktop\MyLog.log,PerfStat,,,append=NO); data PerfStat; set PerfStat(firstobs=3); k=mod(_N_, 2); run; data PerfStat; merge PerfStat PerfStat(firstobs=2 keep=realtime rename=(realtime=lead_realtime)); label lead_realtime="lead_realtime"; if k=1 then do; realtime=realtime+lead_realtime; output; end; run; data hej; do bufsize=1 to 9; do bufno=1 to 9; output; end; end; run; proc format; value bufsize 1='0' 2='4k' 3='8k' 4='16k' 5='32k' 6='64k' 7='128k' 8='256k' 9='512k' ; value bufno 1=1 2=2 3=5 4=10 5=20 6=50 7=100 8=200 9=500 ; run; data Graph(keep=bufsize bufno realtime); merge PerfStat hej; run; title "Elapsed Times for Different Combinations of BUFNO and BUFSIZE"; proc sgplot data=Graph noautolegend; heatmapparm y=bufsize x=bufno colorresponse=realtime / colormodel=(green gold red); text y=bufsize x=bufno text=realtime; xaxis values=(1 to 9) display=(noticks) valueattrs=(size=7) offsetmin=0.05 offsetmax=0.05; yaxis values=(1 to 9) display=(noticks) valueattrs=(size=7) offsetmin=0.05 offsetmax=0.05; format bufno bufno. bufsize bufsize. realtime 10.1; run; title;