BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Bryan
Obsidian | Level 7

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;

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Bryan
Obsidian | Level 7

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.

View solution in original post

6 REPLIES 6
Cynthia_sas
SAS Super FREQ
Hi:
I'm not sure that your preimage is using the right location. When you create images to be used by PDF, the image has to be located in the place where PDF can find it and convert from the PNG file type to an internal PDF representation. When I use PREIMAGE, with ODS PDF or ODS RTF, Since you only have PATH= and not GPATH= in your code, I wonder whether your GNAME variable is actually holding the right location or, perhaps the numbering is "off" if you have run the program several times. PROC GKPI is not controlled by the ODS GRAPHICS statement, so if you are trying to use that to reset the index numbers, it won't work with GKPI -- which is controlled by GOPTIONS -- as shown in this example in the doc:
http://support.sas.com/documentation/cdl/en/graphref/67881/HTML/default/viewer.htm#p03xig9ryvv08mn1s...

If it's not a location issue, then you might want to work with Tech Support on this.

cynthia
Bryan
Obsidian | Level 7

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.

 

ChrisNZ
Tourmaline | Level 20

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;



 

aaa1.PNG

Bryan
Obsidian | Level 7

Sorry, was out on vacation,  tried the code above and still have the same problem, thanks for your help.

Bryan
Obsidian | Level 7

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 4460 views
  • 0 likes
  • 3 in conversation