I'm pretty new to coding and SAS in general. I tried to create a bunch of KPI charts that correspond to the number of rows, but the loop code below keeps creating two of the same GPKI charts for the last row. Why is this the case? Any help will be greatly appreciated.
Thanks
%Macro scanloop (scanfile,field1,field2,field3);
data _null_;
if 0 then set &scanfile nobs=X;
call symput ('Count',X);
stop;
run;
%DO I=1 %To &count;
Data _null_;
set &scanfile (firstobs=&I);
call symput('Client', &field1);
call symput('LossRatio', &field2 );
call symput('Target', &field3 );
stop;
run;
proc gkpi mode=raised;
speedometer actual=&LossRatio bounds=(0 .2 .4 .6 .8 1) /
target=&Target label="&field1 KPI" nolowbound format="percent8.0"
afont=(f="Albany AMT" height=.5cm)
bfont=(f="Albany AMT" height=.4cm) ;
Run;
%end;
%MEND SCANLOOP;
%scanloop (work.Test, Client,LossRatio,Target);run;