Desktop productivity for business analysts and programmers

PDF Template/Style

Not applicable
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.

Posts: 9,424

Re: PDF Template/Style

Posted in reply to deleted_user
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:

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: -- 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.


** 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;
style Header from Header /
style RowHeader from Header /
ods path(remove) permtmpl.template;
** clear the ODS PATH and update access mode;
** you will reestablish the path below when testing;

Now, use the template:
** 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;

ods pdf close;
ods path(remove) permtmpl.template;
Not applicable
Posts: 0

Re: PDF Template/Style

Posted in reply to Cynthia_sas

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

Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation