I'm not the sharpest SAS programmer. My SAS macro in this statement doesn't seem to be running, or at least is not getting put to the pdf. I don't see anything in the SASLOG referencing the macro as well:
%let rptdate = %sysfunc(intnx(day,%sysfunc(today()), -1),weekdate29.); proc sql noprint; select distinct cpcfname into :type from pdb.rmfintrv; quit; proc sql noprint; select distinct system into :systems separated by '|' from pdb.rmfintrv; %let nsystems=&sqlobs; quit; proc sql; create table user.tempcpu as select sysplex label='sysplex', system label='system', hour, min(pctcpuby) as mincpu, avg(pctcpuby) as avgcpu, max(pctcpuby) as maxcpu, min(pctzipby) as minzip, avg(pctzipby) as avgzip, max(pctzipby) as maxzip, min(platbusy) as minplat, avg(platbusy) as avgplat, max(platbusy) as maxplat from pdb.rmfintrv group by sysplex, system, hour; ods _all_ close; ods pdf file="/nitc/perf/test/nfccpu.pdf" style=sasweb notoc; options leftmargin=.5in rightmargin=.5in orientation=landscape; %let sys=%scan(&systems,1,|); proc sgplot data=user.tempcpu; where system="&sys"; title "&type cpu use for &rptdate"; vbar hour / response=maxplat datalabel transparency=0.3 legendlabel='max cpu'; vbar hour / response=avgplat datalabel transparency=0.3 legendlabel='average cpu'; xaxis label='hour'; yaxis label='cpu percentage'; run; %macro graph_cpu(nsystems,systems); %do i=1 %to &nsystems; %let sys=%scan(&systems,&i,|); proc sgplot data=user.tempcpu; where system="&sys"; title "&sys cpu use for &rptdate"; vbar hour / response=maxcpu datalabel transparency=0.3 legendlabel='max cpu'; vbar hour / response=avgcpu datalabel transparency=0.3 legendlabel='average cpu'; vline hour / response=avgzip y2axis lineattrs=(thickness=2 pattern=solid) legendlabel='average ziip'; xaxis label='hour'; yaxis label='cpu percentage'; y2axis label='avg ziip percentage'; run; %end; %mend graph_cpu; run; ods pdf close; run;
Also if anyone has any better suggestions please let them fly. The landscaping option doesn't seem to be working either.
An awful lot things that you code like this:
%do i=1 %to &nsystems; %let sys=%scan(&systems,&i,|); proc sgplot data=user.tempcpu; where system="&sys";
Could be done by
Proc sgplot data=user.tempcpu; by system;
If you are subsetting data on the same variable you could something like
where system in ("value1" "value2" "value5");
though the data would need to be sorted by the By variable(s) as usual.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.