BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I use SAS Management Console to create prompts and SAS Web to produce a report which consist of :

ods text,
proc reports
and proc tabulate.

To display the report I use _odsStyle=Journal3 and _odsDest=pdf. Is it possible to create my own template/style if I want to change fonts / titles/ layout of this pdf?
Thanks,
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
I don't know exactly what you mean by "SAS Web" -- you could mean SAS Web Report Studio, SAS/IntrNet, SAS Information Delivery Portal, the Stored Process Web Application or a custom BI Web Service that you wrote yourself. Additionally you could be using one of the SAS client applications, such as Enterprise Guide or the SAS Add-in for Microsoft Office. I suspect, since you are generating PDF output that you are either using SAS Enterprise Guide, SAS/IntrNet, SAS Information Delivery Portal, the SPWA or a custom BI Web Service.

The short answer is that it is possible to alter the style template that you use with a stored process -- if you understand how your client application handles style information. For example SAS Enterprise Guide uses a CSS (Cascading Stylesheet) version of SAS style templates, so for Enterprise Guide, you might want to use the Style Wizard to draft your new style. SAS Web Report Studio, on the other hand, uses style information that is embedded in the XML instructions for the middle tier "plumbing" that runs Web Report Studio.

The hardest thing to figure out usually is 1) what kind of style is used by your client application and 2) where on the server you need to store the changed style template or CSS file (unless you have a client application that would use a "temporary" template that is created every time the stored process runs). And then the next hardest thing is learning PROC TEMPLATE to change the style elements and style attributes that you want to change. Learning PROC TEMPLATE can be a challenge when you're just working in Base SAS -- since some client applications use CSS or style templates, that adds another layer of complexity when you talk about styles and the BI Platform.

For PROC REPORT and PROC TABULATE, you can use style=overrides in the procedure syntax to alter the style of various report elements (such as fonts and colors). To change the titles of the report, you can use various syntax in the TITLE statement itself, such as:
[pre]
title f='Courier New' h=14pt c=purple 'My Purple Title';
[/pre]

To change the style of ODS TEXT generated lines you can either use ODS ESCAPECHAR functionality or you can change a style template. In the code below, everything is changed in STYLE= overrides. All the fonts are changed to Courier New and the ODS TEXT is changed to Courier New and the header colors are changed -- all without a change to the style template. This might be an approach to try first before you go down the template road.

If you do want to change the ODS style template used for your output, then you will have to
1) learn how to create/change style templates with PROC TEMPLATE
2) learn how to use the ODS PATH statement to control where style templates are written
3) create and test your new template in a local environment and make sure the template works correctly in Base SAS
4) when the template works correctly, create your new template in a location that is accessible to both the Workspace server and Stored Process server (and/or make a CSS version of your new template if you are using a client application that uses CSS)
5) test the template (or CSS file) in all the client applications where the new template could be used.

As I said, you might try using a program similar to the one below (but turned into a stored process) before you go down the template road.

cynthia
[pre]
options orientation=portrait topmargin=.5in bottommargin=.5in nodate nonumber;
title; footnote;
ods pdf file='c:\temp\change_title_font.pdf' notoc startpage=no style=journal3;
ods escapechar='^';

proc report data=sashelp.shoes(obs=5) nowd
style(header)={background=pink font_face='Courier New'}
style(column)={font_face='Courier New'};
column region subsidiary product sales inventory returns;
title f='Courier New' h=14pt c=purple 'My Purple Title';
run;

ods text="^{style[just=c color=purple font_size=14pt font_weight=bold font_face='Courier New']Now For Something Completely Different}";
proc report data=sashelp.prdsale(obs=5) nowd
style(header)={background=yellow font_face='Courier New'}
style(column)={font_face='Courier New'};
run;

ods _all_ close;
[/pre]

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 867 views
  • 0 likes
  • 2 in conversation