Getting the following error "ERROR: Unable to load image /sas/work/SAS_work42770188005A_wasascsprd2.nu.com/SAS_work08B50188005A_wasascsprd2.nu.com/Sldr1.png;
default image will be used instead.", checked the output folder and png in the folder, code below.
/* detect proper delim for UNIX vs. Windows */
%let delim=%sysfunc(ifc(%eval(&sysscp. = WIN),\,/));
/* macro download in work library */
%let download_from = %sysfunc(getoption(work))&delim.;
%put &download_from;
%let bnd1=(5 2.56 2.26 1.64 0);
DATA Kpi_dat;
INPUT Topic $1-6 subject $8-21 nmbr prv actl mn trgt mx cmmnts $49-159;
DATALINES;
Income Revenue 1 1.20 1.05 2.10 2.88 3.40 Need to prepare a turn around plan. Expected completion by 12/1/16.
;
run;
%macro slider(gname, actl, trgt,rng);
goptions reset=all noborder
xpixels=80 ypixels=25
ftext='Arial';
ods graphics / reset=index;
ods html path="&download_from" (url=none) file="&gname..html" style=listing;
proc gkpi mode=raised;
hslider actual=&actl bounds=&&bnd&rng /
noavalue nobvalue
target=&trgt colors=(red,yellow,green,blue)
name="&gname";
run;
quit;
ods html close;
%mend slider;
data Kpi_rpt (keep=topic subject gname nmbr mn trgt mx actl clrFlg prv chng cmmnts);
set Kpi_dat;
if mx > mn then chng=actl-prv;
if mx < mn then chng=prv-actl;
if mx > mn then
do;
if mn > actl then clrFlg=1;
else if mn =< actl and actl < trgt then clrFlg=2;
else if trgt =< actl and actl < mx then clrFlg=3;
else if mx =< actl then clrFlg=4;
trgt_=trgt+trgt*0.05;
end;
else
do;
if mn < actl then clrFlg=1;
else if mn >= actl and actl > trgt then clrFlg=2;
else if trgt >= actl and actl > mx then clrFlg=3;
else if mx >= actl then clrFlg=4;
trgt_=trgt-trgt*0.05;
end;
gnm=compress("Sldr"||_N_);
gname=trim("&download_from")||compress("Sldr"||_N_)||".png";
txt='%slider('||gname||','||put(nmbr,4.1)||')'; put txt;
call execute('%slider('||trim(gnm)||','||put(actl,4.1)||','||put(trgt_,4.1)||','||nmbr||')');
run;
ods pdf notoc file="&download_from.Test.pdf";
proc report data=Kpi_rpt nowd wrap;
column topic subject gname gsprk mn trgt mx actl slider cmmnts;
define topic / order noprint;
define subject / display 'Metric' format=$superfmt. display ;
define gname / noprint;
define gsprk / noprint;
define mx / display 'Max' format=COMMA4.2 ;
define trgt / display 'Target' format=COMMA4.2 ;
define mn / display 'Min' format=COMMA4.2 ;
define actl / display 'Actual' format=COMMA4.2;
define slider / computed 'Current Month';
define cmmnts / display flow 'Comments';
compute slider / char length=62;
slider=' ';
call define ('slider','style',"style=[preimage='"||trim(gname)||"']");
endcomp;
run;
ods pdf close;
ods _all_ close;
Figured it out. The filename was being saved out on the UNIX box as all lower case whereas in the code the first character was upper case, once I switched the code to lower case for the first character it worked, thanks for your input and help.
Added a gpath and still getting the same error.
goptions reset=all noborder xpixels=80 ypixels=25 ftext='Arial' ; ods graphics / reset=index; ods html
path="/sas/work/SAS_workF8B001B800A4_wasascsprd2.nu.com/SAS_workC06401B800A4_wasascsprd2.nu.com/"
2 + gpath="/sas/work/SAS_workF8B001B800A4_wasascsprd2.nu.com/SAS_workC06401B800A4_wasascsprd2.nu.com/" (url=none)
file="Sldr1.html" style=listing; proc gkpi mode=raised; hslider actual=2.88 bounds=(5 2.56 2.26 1.64 0) / noavalue nobvalue
target=. colors=
NOTE: Writing HTML Body file: Sldr1.html
3 +(red,yellow,green,blue) name="Sldr1"; run;
ERROR: Unable to load image /sas/work/SAS_workF8B001B800A4_wasascsprd2.nu.com/SAS_workC06401B800A4_wasascsprd2.nu.com/Sldr1.png;
default image will be used instead.
Also verified that the file is in the directory and the file is not getting re-indexed.
I changed a few things and this works fine for me.
/* detect proper delim for UNIX vs. Windows */
%let delim=%sysfunc(ifc(%eval(&sysscp. = WIN),\,/));
/* macro download in work library */
%let download_from = %sysfunc(getoption(work))&delim.;
%put &download_from;
%let bnd=(5 2.56 2.26 1.64 0);
DATA Kpi_dat;
INPUT Topic $1-6 subject $8-21 nmbr prv actl mn trgt mx cmmnts $49-159;
DATALINES;
Income Revenue 1 1.20 1.05 2.10 2.88 3.40 Need to prepare a turn around plan. Expected completion by 12/1/16.
;
run;
%macro slider(gname, actl, trgt,rng);%macro _;%mend _;
goptions reset=all noborder xpixels=80 ypixels=25 ftext='Arial';
ods graphics / reset=index;
ods html path="&download_from" (url=none) file="&gname..html" style=listing;
proc gkpi mode=raised;
hslider actual=&actl. bounds=&bnd. /
noavalue nobvalue
target=&trgt. colors=(red,yellow,green,blue)
name="&gname";
run;
quit;
ods html close;
%mend slider;
data Kpi_rpt (keep=topic subject gname nmbr mn trgt mx actl clrFlg prv chng cmmnts);
set Kpi_dat;
if mx > mn then chng=actl-prv;
if mx < mn then chng=prv-actl;
if mx > mn then do;
if mn > actl then clrFlg=1;
else if mn =< actl and actl < trgt then clrFlg=2;
else if trgt =< actl and actl < mx then clrFlg=3;
else if mx =< actl then clrFlg=4;
trgt_=trgt+trgt*0.05;
end;
else do;
if mn < actl then clrFlg=1;
else if mn >= actl and actl > trgt then clrFlg=2;
else if trgt >= actl and actl > mx then clrFlg=3;
else if mx >= actl then clrFlg=4;
trgt_=trgt-trgt*0.05;
end;
GNM=cats("Sldr",_N_);
GNAME=cats("&download_from.Sldr",_N_,".png");
TXT=cats('%slider(',GNAME,',',NMBR,')');
call execute(cats('%slider(',gnm,',',actl,',',trgt_,',',nmbr,')'));
run;
ods pdf notoc file="&download_from.Test.pdf";
proc report data=Kpi_rpt nowd wrap;
column topic subject gname gsprk mn trgt mx actl slider cmmnts;
define topic / order noprint;
define subject / display 'Metric' format=$superfmt. display ;
define gname / noprint;
define gsprk / noprint;
define mx / display 'Max' format=COMMA4.2 ;
define trgt / display 'Target' format=COMMA4.2 ;
define mn / display 'Min' format=COMMA4.2 ;
define actl / display 'Actual' format=COMMA4.2;
define slider / computed 'Current Month';
define cmmnts / display flow 'Comments';
compute slider / char length=62;
slider=' ';
call define ('slider','style',"style=[preimage='"||trim(gname)||"']");
endcomp;
run;
ods pdf close;
ods _all_ close;
@Bryan Have you solved the issue?
Sorry, was out on vacation, tried the code above and still have the same problem, thanks for your help.
Figured it out. The filename was being saved out on the UNIX box as all lower case whereas in the code the first character was upper case, once I switched the code to lower case for the first character it worked, thanks for your input and help.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.