BookmarkSubscribeRSS Feed
DanielKaiser
Pyrite | Level 9

Hello together,

i have written a Proc Template and want to put an Headerimage in it.

At the moment it looks like this

BODY FROM BODY /

    PREIMAGE="W:\Prz-SAS92\HUKModifications\HUKStyles\Style\HUKBanner.png";

But if i do it like this, the banner is under the title.

I want it at the topic of my output.

anybody a idea?

Best regards so far.

Daniel

P.S.: We are using EG 4.3 with SAS 9.2

5 REPLIES 5
Cynthia_sas
SAS Super FREQ

Hi:

  For HTML output, the BODY of the document will probably come after the SAS title. One way to use a BANNER image (like the EG banner) is to edit the Cascading Style Sheet file (CSS) that is used by EG -- via Style Wizard specifications, such as shown in this paper:

  http://www2.sas.com/proceedings/forum2007/141-2007.pdf

The paper shows how to reference the CSS file that is created by the EG Style Wizard. Alternately, the paper also shows how to pass an image into an HTML HEADTEXT= option -- which will cause the image to appear BEFORE any BODY output.

A third option, is to code TITLE1 statement to reference an image file on the server and then code TITLE2 statement to be the title you want. See code below. Note that in my code, the file KERMIT.JPG is stored in the c:\temp directory. If your location for KERMIT.JPG is different or on a web server, you might need to provide different values for PATH= and/or the PREIMAGE tag. Tech Support could help you figure out the correct path and value, given your configuration and image location.

cynthia

ods listing close;

ods html path='c:\temp' (url=none)

         file='useimage.html'

         style=sasweb;

        

ods escapechar='~';

title1 '~{style [preimage="kermit.jpg"]} ';

title2 'My Title';

 

proc print data=sashelp.class(obs=3);

run;

  

ods html close;


kermit_image.jpg
DanielKaiser
Pyrite | Level 9

Hi,

well i need to have the Banner in the Proc Template cause the user shouldn´t have to add it by himself.

Isn´t there a opportunity to do it in proc template and have it above the Title?

Regards

Daniel

Cynthia_sas
SAS Super FREQ

Hi:

  Well, I'm baffled. I decided to try making a change to the BODY element as a "before" -- and then planned to try a few other style template approaches. However, when I use SAS 9.2 and use a PREIMAGE override in the BODY style element, I get the image ABOVE the title (see screen shot). So, if you don't want to try any of the other workarounds, then I would suggest that you open a track with Tech Support on this issue. (I notice that you did not post all your template code, so one of the advantages of working with Tech Support is that they could look at ALL your code and test your code in the same version of EG and version of SAS that you are using.)

cynthia

** the Code;

ods listing close;
title;
ods path work.temp(update)
         sashelp.tmplmst(read);

                   

** Test Image on BODY style element;
proc template;
  define style styles.bodychg;
  parent=styles.sasweb;
  class Body / 
    just=c
    preimage='kermit.jpg' ;
  end;
run;
               
ods html(id=after) path='c:\temp' (url=none)
    file='pix_on_body.html'
    style=styles.bodychg;
                     
proc print data=sashelp.class(obs=3);
  title1 'Pix above Title1';
run;
         
ods _all_ close;
title;


body_tag_change.jpg
DanielKaiser
Pyrite | Level 9

Ok.

I tryed it again. And discovered that the problem only appears if i use "startpage=no"

Here is my code, maybe you have an idea how to change this. I have a PDF Output. If not i will contact the Tech Support. And regards for your help as far.

PROC TEMPLATE;

DEFINE STYLE HUK2;

PARENT = Styles.Printer;

STYLE fonts from fonts /

  'TitleFont' = ("Arial",24pt)

  'TitleFont2' = ("Arial",16pt)

  'StrongFont' = ("Arial",10pt,Bold)

  'EmphasisFont' = ("Arial",10pt,Italic)

  'headingEmphasisFont' = ("Arial",10pt,Bold Italic)

  'headingFont' = ("Arial",10pt,Bold)

  'docFont' = ("Arial",10pt)

  'footFont' = ("Arial",5pt)

  'FixedEmphasisFont' = ("Courier",9pt,Italic)

  'FixedStrongFont' = ("Courier",9pt,Bold)

  'FixedHeadingFont' = ("Courier",9pt,Bold)

  'BatchFixedFont' = ("Courier",6.7pt)

  'FixedFont' = ("Courier",9pt);

CLASS color_list /

  'link' = blue   /* links */

  'bgH' = cxF4C61B        /* row and column header background */

  'fg' = black   /* tabletext color */

  'st' = cx6E6E6E   /* system title color */

  'pt' = cx969696   /* proc title color */

  'ft' = #AAAAAA   /* foot note color */

  'bg' = white   /* page background color */

  'tb' = cx4F493B   /* Table border color */

  'cb' = cxDCDCDC   /* Cell background color */

  'tib' = cxF4C61B;  /* Table Title background color */

CLASS Body from Document /

  bottommargin = 0.25in

  topmargin = 0.25in

  rightmargin = 0.25in

  leftmargin = 0.25in;

CLASS BODY /

  PREIMAGE="W:\Prz-SAS92\HUKModifications\HUKStyles\Style\HUKBanner.png";

CLASS TABLE /

  padding = 5

       borderspacing = 1px

       frame = box

       rules = all

       bordertopwidth = 1px

       borderleftwidth = 1px

       borderbottomwidth = 1px

       borderrightwidth = 1px

       bordercolor = color_list('tb')

       bordercollapse = separate;

CLASS COLORS /

  'headerfgemph'   =  color_list('fg')

  'headerbgemph'   =  color_list('tib')

  'headerfgstrong'  =  color_list('fg')

  'headerbgstrong'  =  color_list('tib')

  'headerfg'    =  color_list('fg')

  'headerbg'    =  color_list('tib')

  'datafgemph'   =  color_list('fg')

  'databgemph'   =  color_list('cb')

       'datafgstrong'   =  color_list('fg')

       'databgstrong'   =  color_list('cb')

       'datafg'    =  color_list('fg')

       'databg'    =  color_list('cb')

  'batchbg'    =  color_list('fg')

  'batchfg'    = color_list('bg')

  'tableborder'   = color_list('fg')

  'tablebg'    = color_list('fg')

  'proctitlefg'   =  color_list('pt')

  'proctitlebg'   =  color_list('bg')

  'titlefg'    =  color_list('fg')

  'titlebg'    = color_list('bg')

  'systitlefg'   = color_list('st')

  'systitlebg'   = color_list('bg')

  'contentfg'   = color_list('fg')

  'contentbg'   = color_list('bg')

  'contitlefg'  = color_list('fg')

  'confolderfg'  = color_list('fg')

  'conentryfg'  = color_list('fg')

  'docfg'    = color_list('fg')

  'docbg'    = color_list('bg')

  'captionbg'   =  color_list('bg')

  'captionfg'   = color_list('fg')

  'notefg'   = color_list('fg')

  'notebg'   = color_list('bg')

  'link2'    = color_list('link')

  'link1'    = color_list('link')

  'bylinebg'   = color_list('bg')

  'bylinefg'   = color_list('fg')

  'gheader'   = color_list('st');

class GraphBackground /

  backgroundcolor  =  white

  color     =  white;

class Header from Header /

  Cellwidth = 10%;

END;

RUN;

ODS PDF FILE = 'Y:\SAMPLE.PDF' STYLE=HUK2 STARTPAGE=NO;

TITLE 'Title';

FOOTNOTE 'Footnote';

PROC PRINT DATA = SASHELP.CLASS;

RUN;

ODS PDF CLOSE;

Cynthia_sas
SAS Super FREQ

Ah, that was a critical piece of information. Remember how I started my previous post "For HTML output"?? The BODY style element only has an impact on HTML in the fashion that I discussed and showed in the screen shot. RTF and PDF output destinations are NOT HTML and the BODY style element works differently with them than with HTML. A BODY style element change with PDF will behave just as you describe. PDF expects that the SAS Title will ALWAYS be the very first thing on any image of a piece of paper. So when you use STARTPAGE=NO, the normal page eject at the beginning of procedure output is removed and PDF has to decide what to do with the title. With all your output able to fit on one page, the very, very first thing that PDF will put on an image of a piece of paper is the SAS Title. Then the preimage from the BODY style element -- this means that with PDF the title will be above the image. That's why, for PDF, the quickest solution is to put the preimage reference in a STYLE override in a TITLE statement.

  So, your choices are to put your image into a TITLE statement, using ODS ESCAPECHAR, as I showed in my Jul 27 posting or to modify the style template to put the image on the first style element for title (assuming you are using SAS 9.2 [which is another critical piece of information]).

  Code shown below shows the style template method. Code was tested in SAS 9.2, as shown in the attached screen shot. In 9.2 (but NOT in 9.1.3), you can change the systemtitle-systemtitle10 elements. Since systemtitle2-systemtitle10 all inherit from the main system title style element, we need to change the inheritance on 2 thru 10 to ensure that they do NOT use an image.

  As I suggested before, if you work with Tech Support, they can look at ALL your code and your data and replicate your issue on the same level of SAS as you are using.

cynthia


proc template;
  define style styles.titlechg;
  parent=styles.printer;
  class systemtitle / 
    just=c
    preimage='c:\temp\kermit.jpg' ;
  class systemtitle2 from TitlesandFooters ;
  class systemtitle3 from TitlesandFooters ;
  class systemtitle4 from TitlesandFooters ;
  class systemtitle5 from TitlesandFooters ;
  class systemtitle6 from TitlesandFooters ;
  class systemtitle7 from TitlesandFooters ;
  class systemtitle8 from TitlesandFooters ;
  class systemtitle9 from TitlesandFooters ;
  class systemtitle10 from TitlesandFooters ;
  end;
run;

                      

ods pdf style=titlechg
        body='c:\temp\pixtitlex.pdf';
   proc print data=sashelp.class(obs=3);
   title1 ' ';
   title2 'My Title below image';
   run;
ods pdf close;
ods listing;


template_picture_pdf.jpg

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!

What is Bayesian Analysis?

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.

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
  • 5 replies
  • 2669 views
  • 0 likes
  • 2 in conversation