Desktop productivity for business analysts and programmers

PDF Template/Style

Reply
N/A
Posts: 0

PDF Template/Style

Hi there.
Our company has previously created a CSS sheet for HTML output. I am wondering how to get similar results out of PDF output (including the use of images, Proc Gchart, and Proc Print). I know that CSS will be available for PDF in 9.2 but I need a quicker solution. I have previously tried to modify the template using Proc Template but the log stated that it was unable to write and that the default style "Printer" would be used.

How can I make our PDF output look pretty? Thanks in advance for any and all suggestions.

Matt
SAS Super FREQ
Posts: 8,814

Re: PDF Template/Style

Hi:
Since you are working in EG, most probably with SAS on a server, you will need to have your administrator give you a place on the server to which you can write your style template. This Tech Support note probably describes what you're experiencing:
http://support.sas.com/kb/7/484.html

If you use the code in the note to create a new style template, by default, SAS will try to write altered templates to SASUSER.TEMPLAT location, but this may not be a write-able location on your server. And, if you want others to be able to use the template for PDF, you need a location that is available to everybody, since sometimes SASUSER files are created for every user and other users may not have access to your SASUSER location.

This Tech Support note shows the use of the ODS PATH statement to point to a template store on the SAS server: http://support.sas.com/kb/15/201.html -- although the note itself is talking about banner images and HTML, the same type of code would be used for your style template for PDF...something like what is shown below.

If you need more help, you might consider having your SAS Administrator contact Tech Support for help with setting up a permanent location for templates on your SAS server.

cynthia

[pre]
** 1) Create the template (only do this once or a few times while;
** you are testing the template code);
options nodate nonumber;
ods _all_ close;

libname permtmpl 'c:\temp\output';
** this would be a server location path and NOT a local location.;
** I used a local location for testing because I do not have a server;
** copy of SAS to test with.;

ods path (prepend) permtmpl.template(update);

proc template;
define style styles.mypdf;
parent=styles.printer;
style Header from Header /
background=pink
font_size=14pt;
style RowHeader from Header /
background=cyan
font_size=12pt;
end;
run;
ods path(remove) permtmpl.template;
** clear the ODS PATH and update access mode;
** you will reestablish the path below when testing;
[/pre]

Now, use the template:
[pre]
** 2) Now use the template. I would put this testing code into a different;
** .SAS file so that testing could be separated from template creation;
** and then you have code that is easy to pass on to other folks because;
** it does not have template creation code in it.;

libname permtmpl 'c:\temp\output';
** this would be a server location path;

** define the ODS PATH as READ for regular template USE.;
** You use the PREPEND option so you do not tamper with any of the;
** template or item stores that EG has defined for use.;

ods path (prepend) permtmpl.template(read);

ods pdf file="TestStyle.pdf" style=styles.mypdf;

proc print data=sashelp.class;
run;

ods pdf close;
ods path(remove) permtmpl.template;
[/pre]
N/A
Posts: 0

Re: PDF Template/Style

Cynthia,

Thanks for the in-depth help and quick response. I'll give it a try.




Matt
Ask a Question
Discussion stats
  • 2 replies
  • 116 views
  • 0 likes
  • 2 in conversation