BookmarkSubscribeRSS Feed
RussellAlmeida
Calcite | Level 5
Hi,

I am trying to create a report using ODS PDF on Unix and would like to insert an image on the right top of the page, when add the path it gives me the following error and prints the report with the default image

ERROR: Unable to load image Posten_Logo.gif; default image will be used instead.

I verified that the image with the correct spelling is available in the default path.

Please suggest.

Regards
Russell
9 REPLIES 9
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Where's your SAS code? Without it, it's a guessing game.

Scott Barry
SBBWorks, Inc.
Cynthia_sas
SAS Super FREQ
Hi:
As Scott suggests, seeing your code will be very helpful. If you search support.sas.com, you may find other notes like this one;
http://support.sas.com/kb/24/488.html (which explains that you must have an ABSOLUTE reference if you are using PREIMAGE with PDF). So, for example, generally using:
[pre]
preimage="xxx.gif"
[/pre]

does NOT work with PDF ... so you would need:
[pre]
preimage="/usr/local/images/xxx.gif" OR
preimage="http://www.server.com/images/xxx.gif"
[/pre]

cynthia
RussellAlmeida
Calcite | Level 5
Hi,

The code as requested.


ODS _ALL_ CLOSE;
*FILENAME EGPDF 'test.pdf';
*ODS PDF(ID=EGPDF)
FILE=EGPDF
NOTOC
STYLE=border ;
ods pdf file="RD033.pdf" notoc style = border;

;
ods escapechar ='~';

title1
justify = c font=Helvetica height=9pt bold '#ByVal1' ;

title2
justify = l font=arial height=8pt '#ByVal2 '
justify = r font=arial height=8pt "Utskriftsdato: &_sysdate. kl &systime. side ~{thispage} av ~{lastpage} ";
title3;
title4
justify = l font=arial height=8pt '#ByVal3' justify = c font = arial height = 8pt "Postnummer fra: &from_cd.";
title5
justify = c font=arial height=8pt "Postnummer til:&to_cd." ;

title6 '_____________________________________________________________________________________';



footnote1 ;
footnote2;
footnote3;
footnote4;
footnote5;
footnote6;
footnote7;


proc report data = VL0608_104R_ADDRESS_DISTR_LST1 nowd spacing = 50 wrap ls=100
style(summary)={htmlstyle="border-top:solid;border-bottom:solid"} split='*';
* BY Report_name Report_ID Org_unit_Nm Org_unit_id;
BY Report_Name Report_Id Title_Line2;* Postal_Code_Cd Sort_Variable Address_List;

columns
Report_Name
Report_Id
Postal_Code_Cd
Sort_Variable

Address_list
Organization_id
Organization_Nm
Rack_Id
Sort_Variable
_Postal_Code_Cd;


define Report_ID/group noprint;
define Report_name/group noprint;
define Sort_Variable/order noprint;
define Postal_Code_Cd/noprint;
define Location_set_type_cd/group noprint;


define Address_list/left flow "GATE/VEI/STED" spacing=20
style(column)=[cellwidth=380pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;

define Organization_Nm/left flow " "
style(column)=[cellwidth=10pt font=(Arial, 6pt) just = left] flow
style(header)= [cellwidth=10pt font_weight=bold font=(Arial, 6pt) just = left] flow;

define Organization_id/left flow 'ENHET' spacing = 10
style(column)=[cellwidth=50pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;

define Rack_Id/left 'REOLNR' spacing = 10
style(column)=[cellwidth=50pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;

define _Postal_code_cd/left 'POSTNR' spacing = 10
style(column)=[cellwidth=50pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;
break after Sort_Variable/skip ol suppress;


compute after Sort_Variable;
line ' ';
endcomp;
run;
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The SAS code piece posted in your reply makes no direct/obvious reference to the image file named in the ERROR message.

Also, did you review the link provided by Cynthia's reply and change your code accordingly for ODS PDF? It's as if you simply replied and pasted your code without considering all replies in the thread??

After sufficient desk-checking and self-review, suggest you post the actual SAS log output with your generated SAS code listed along with the SAS-generated error message and related other messages intact.

Scott Barry
SBBWorks, Inc.

Message was edited by: sbb Message was edited by: sbb
Cynthia_sas
SAS Super FREQ
Hi:
As Scott said, I don't see an obvious reference to an image in your posting. So, from looking at your code, I wouldn't expect to see an image in the output because I see no image reference in the code.

However, I do have 3 comments:
1) It looks like you are using a custom style template:
[pre]
ods pdf file="RD033.pdf" notoc style = border;
[/pre]

You might reference your IMAGE (either PREIMAGE or POSTIMAGE) in the STYLE template. If so, the note I originally posted still applies. You must use an ABSOLUTE file reference to point to the location where the image is located WHEN the PDF file is CREATED.

2) I note that it's possible EG is involved in your submission process because of this commented code:
[pre]
*ODS PDF(ID=EGPDF) FILE=EGPDF NOTOC STYLE=border ;
[/pre]
--which is a somewhat typical EG submission convention (ID=EGPDF). Unless you are running on a LOCAL install of SAS, the image for the PDF has to be on the SAME server where SAS is running (or in a network location available to the server). This means, again, that you must use an ABSOLUTE path name on the server machine where the SAS code is running. If the image is on your local drive and SAS is running on a server, the server has no visibility of your local drive while the code is running -- so you may have to FTP the image to the server and note the physical, ABSOLUTE path name on the server in your template or in your code or wherever your image reference is.

3) I noted syntax in your code that is generally either LISTING only and/or HTML-only technique:
[pre]
. . . spacing = 50 wrap ls=100
style(summary)={htmlstyle="border-top:solid;border-bottom:solid"} split='*';
[/pre]
---spacing=50, wrap, ls are all LISTING only syntax and are generally ignored by all other ODS destinations
---the use of HTMLSTYLE attribute overrides with CSS style properties is an HTML or Markup family only technique. ODS PDF is -NOT- a Markup family destination, nor is it an HTML destination. So I would not expect this code to work.

However, since you did not show the code that references the image, it is still hard to suggest what might be wrong. You may wish to open a track with Tech Support on this matter. Be sure to provide them with ALL your code -- the style template, the image reference, and the code that uses the style template.

cynthia
Cynthia_sas
SAS Super FREQ
Hi:
Just a followup (thanks Scott H. for reminding me of this). If you are using PREIMAGE to point to an image along with ESCAPECHAR the LASTPAGE function, this Tech Support note may apply:
http://support.sas.com/kb/34/573.html

cynthia
Catrin
Obsidian | Level 7
Hello, we also need to have ODS PDF output with logo on top of the page and page numbering like page x of y on the other hand. SAS 9.2 Unix machine.

We are aware of the SAS-Note: "Problem Note 34573: Use of LASTPAGE inline function causes images to disappear". We are looking for a work around and came up to the paper of Chang Y. Chung "http://changchung.com/download/pageXofY_draft.pdf". We tried first to get correct page numbering and failed. Please find draft code following here:

%macro pageXofY(report=, dummy=dummy);
%global page pages len;
%let page = 0;
%let len = 8;

filename _dummy "&dummy.";

proc printto print = _dummy; run;
%unquote(&report.)
proc printto; run;



filename _dummy clear;


%let pages = &page.;

%let page = 0;
%let len = %eval(%length(&pages.) * 2 + 4);
%unquote(&report.)

%mend pageXofY;


/* example data set */
data one;
do var = 1 to 100;
output;
end;
run;


/* example usage */
options linesize=64 nonumber nodate;

ods listing close;
ods pdf file="/u/m500381/sassrc/AAB/seite.pdf";

%pageXofY(report=%nrstr(
proc report data=one nowd headline missing;
column var;
define var / display;
compute after _page_;
call execute('%let page = %eval(&page. + 1);'); /* 7.b. */
length _XofY $&len.; /* 7.c. */
_XofY = symget('page') || ' of ' || symget('pages'); /* 7.d. */
line 'page ' _XofY $&len..; /* 7.e. */
endcomp;
run;
))

ods pdf close;
ods listing;

Has anyone used this macro to solve the problem?
Or does have an example for solving this problem anyway.

Thanks in advance
Catrin
Cynthia_sas
SAS Super FREQ
Hi:
I do remember this paper...if you look at the reference section at the end of the paper, you'll see references back in 1999, 2000, 2001, etc. This is an older paper and if you notice, there are NO ODS invocation statements in the code shown in the paper. The paper's macro is capturing LISTING page numbers, which are probably different than ODS PDF page numbers.

The paper authors say that they are 1) running PROC REPORT twice, once to get the page numbers (these HAVE to be LISTING page numbers because of the use of PROC PRINTTO) and 2) that their method is an ALTERNATIVE to ODS RTF and the {pageof} ESCAPECHAR function.

There used to be a macro called the PAGEOF macro, first described in this paper: http://www2.sas.com/proceedings/sugi24/Coders/p081-24.pdf And folks used to use this macro to get page X of Y page numbers in their LISTING output. Then, the people in Tech Support came up with a version of the PAGEOF macro for using with the LISTING output:
http://support.sas.com/kb/23/209.html

Then, there was a version of the PAGEOF macro designed for ODS PS (PostScript) and if you need to generate page X of Y page numbers, this is the macro you should use and not one designed for the LISTING destination. This will mean that you have to use Adobe Acrobat to distill the PostScript file into a PDF file, however. Also, I don't know whether you can insert images into the PS file when you use the PS pageof macro...that would be a question for Tech Support. You can find information about the PostScript version of the pageof macro here:
http://support.sas.com/rnd/base/ods/odsprinter/

And then look under the header
Archive: SAS 8.2 ODS PRINTER Family and the Pageof macros will be listed as the first topic. (when you click on the link a .SAS file is downloaded, so you must have popups enabled to see the download box.)

cynthia

PS -- you might want to work with Tech Support first to see whether it's possible to use an image with the PostScript pageof macro in the first place. If it's not going to be possible, then there may not be any point going down this road.

To open a track with Tech Support, fill out the form at this link:
http://support.sas.com/ctx/supportform/createForm
Catrin
Obsidian | Level 7
Thanks Cynthia,

yes, in the meantime it was getting clear that it couldn't work, what I tried.
Your comments are helpful anyway.
Catrin

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
  • 9 replies
  • 8755 views
  • 0 likes
  • 4 in conversation