Hi,
Below is a snapshot of my code:
%let report_dir = %sysfunc(pathname(work));options missing = '';
ods escapechar = "^";
ods pdf file="&report_dir/Report.pdf" pdftoc=1 startpage=yes bookmarklist=hide;
Title j=l "^{style[preimage='C:\Pre\B2.png']}";
footnote j=r "^{style[preimage='C:\Pre\B.png']}";
footnote2 j=c font='Arial' h=12pt "Report for Quarter1";
ods pdf startpage=now;
ods proclabel 'Cover Page';
proc odstext;
p;p;p;p;
p "Report"/ style=[font=(Arial, 30pt) foreground=black just=c font_weight=bold];
p;p;p;p;p;p;p;p;p;
run;
ods pdf startpage=now;
footnote;
ods proclabel ="Summary" ;Title j=c font='Arial' h=18pt "Summary";%summary_pg(PAGE1);
ods pdf close;
My pdf is created in the way I want, but the cover page comes out with ? on the top left and bottom right with the below error in the log:
ERROR: Unable to load image C:\Pre\B.png; default image will be used instead.
Where should I save my image such that SAS is able to retrieve it?
Thanks
Try wrapping the preimage value in extra quotes.
ods escapechar='^';
ods pdf file="&report_dir./Report.pdf" pdftoc=1 startpage=yes bookmarklist=hide;
Title j=l "^{style[preimage=""&report_dir./B.png""]}";
I have a excel file saved on my C: drive which I import at the beginning so I assume SAS can access my C: drive.
I am running on a BI_Server
ERROR: Unable to load image C:\Pre\B.png; default image will be used instead. (<--- the entire message)
@new_sas_user_4 wrote:
I have a excel file saved on my C: drive which I import at the beginning so I assume SAS can access my C: drive.
I am running on a BI_Server
ERROR: Unable to load image C:\Pre\B.png; default image will be used instead. (<--- the entire message)
That's not necessarily true - it depends on how you imported the file. If you did it via the GUI rather than code it could very well be that SAS cannot see your C drive. In that case the 'import step' actually includes an upload step to upload the data to the server.
Yea, I do use the File--> Import option to import the excel file, thanks for explaining that!
Is there a way I can save the image on the server then ?
So, I have to find a way to save the image on the server or a drive that SAS can access ....right?
@new_sas_user_4 wrote:
Hi,
Below is a snapshot of my code:
%let report_dir = %sysfunc(pathname(work));options missing = '';
ods escapechar = "^";ods pdf file="&report_dir/Report.pdf" pdftoc=1 startpage=yes bookmarklist=hide;
Title j=l "^{style[preimage='C:\Pre\B2.png']}";
footnote j=r "^{style[preimage='C:\Pre\B.png']}";
footnote2 j=c font='Arial' h=12pt "Report for Quarter1";ods pdf startpage=now;
ods proclabel 'Cover Page';proc odstext;
p;p;p;p;
p "Report"/ style=[font=(Arial, 30pt) foreground=black just=c font_weight=bold];
p;p;p;p;p;p;p;p;p;
run;ods pdf startpage=now;
footnote;
ods proclabel ="Summary" ;Title j=c font='Arial' h=18pt "Summary";%summary_pg(PAGE1);
ods pdf close;
My pdf is created in the way I want, but the cover page comes out with ? on the top left and bottom right with the below error in the log:
ERROR: Unable to load image C:\Prepaid\B.png; default image will be used instead.
Where should I save my image such that SAS is able to retrieve it?
Thanks
The section of your message that I highlighted in blue is on one of the reasons we say to copy the code and messages from the log and paste them into a code box opened with the {I} or "running man" icons. The box will preserve formatting and indicate what was actually in the log.
If you look at the code I highlighted in RED you can see that the "code" does not conform to the error message. The error message says that you were attempting to use files in the directory C:\Prepaid but the code shows C:\Pre. So at this point we really can't tell what else you may have submitted that is not in your shown code.
Understanding your environment, server vs local install, and paths and permissions are important.
I am sorry,
the error message is :ERROR: Unable to load image C:\Pre\B.png; default image will be used instead.
I modified the name of the folder under C: before posting.
If you're using SAS Enterprise Guide to run your code on a remote server, it won't be able to see your C: drive.
You can copy the image files to the server (say, to the %sysfunc(pathname(work)) folder) by using the Copy Files task in EG. And then change your program code to reference the images from there. Make sure the Copy Files task runs before your program.
The Copy Files task accepts macro variables/functions as path/filename descriptors.
Chris
I am working on SAS EG version 6.1
I dont see the Copy files option under Tasks-->Data
can I install it by any chance?
That depends on your set up. If they've given you permissions to install extensions you should be fine - most places I've worked have had that feature locked down though.
@new_sas_user_4 wrote:
I am working on SAS EG version 6.1
I dont see the Copy files option under Tasks-->Data
can I install it by any chance?
Steps to install are in this blog post. You will need to download a ZIP, copy a DLL into your user profile area, and probably change a security flag on that DLL (all doc'd in the ZIP file instructions).
The task is built into EG v7.13 and later.
Thanks Chris!
I did copy the SAS.tasks.CopyFiles61.dll to the custom folder but can't see it(under Add-in) when I reopen my SAS session 😞
@new_sas_user_4 - Did you complete this step after copying the file?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.