BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DavidPhillips2
Rhodochrosite | Level 12

I'm trying to use a custom style with a PDF that is written to a Server path by a stored process.  The PDF is created but the style does not take effect.

 

ods pdf (id=VCU_Report_Printing) style=VCU_Report_Printing file='serverpath/test5.pdf' pdftoc=3;

options nobyline nodate;

/*proc report*/


ods pdf close;
ods pdf(id=VCU_Report_Printing) close;

 

Custom Style with PDF and Stored Process

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  Enterprise Guide has a location on your C: drive for your style. Unfortunately, the stored process and the Workspace server or Stored Process server probably are NOT able to read the style on your C: drive. The style template has to be accessible to the server that is running the code because the style elements will be added up on the server, for PDF, not down on your machine when you open the PDF.

 

  This older handout from a NESUG presentation talked about how to store a customized template in the LEV1 folder used by the servers for a stored process. Here's the handout: https://support.sas.com/rnd/papers/regional08/SP_Template.pdf -- the paper was specifically talking about changing a tagset template, but could just as well have been changing a style template. In this presentation, I didn't need a custom style. but the concept is the same. You can deal with a custom style by getting permission from your SAS Administrator to run a job from a server that has write access to the Lev1 folder and you'll need to make sure your custom style template is written up there.

 

  Then, as shown in the handout, you'll need to alter your stored process code (in the handout it shows using the tagset template in _odsdest setting, but instead, you'd do your override for _odsstyle %LET statement:

libname lb_srv "<path to Lev1 folder where style template was created>";
** name of item store is lb_srv.templat, as an example;

ods path(prepend) lb_srv.templat(read);

%let _odsstyle = ** new style that lives in above path;
%let _odsdest = pdf;

%stpbegin;

*** rest of code;

%stpend;
ods path(remove) lb_srv.templat(read);

 

 

If you are using the EG Stored Process Wizard, you might have to turn off the automatic inclusion of the %STPBEGIN/%STPEND because you need to be sure that your libname statement for the template store and the ODS PATH(PREPEND) and the %LET statements all happen BEFORE the %STPBEGIN.

 

Hope this gets you pointed in the right direction.

 

Cynthia

View solution in original post

6 REPLIES 6
DavidPhillips2
Rhodochrosite | Level 12

It turns out that Enterprise Guide is not finding my style.  My custom style is setup as my default for general output.  I have my own local custom style.  Do I need to place it in a particular location to reference it in an ODS call?

Cynthia_sas
SAS Super FREQ

Hi:

  Enterprise Guide has a location on your C: drive for your style. Unfortunately, the stored process and the Workspace server or Stored Process server probably are NOT able to read the style on your C: drive. The style template has to be accessible to the server that is running the code because the style elements will be added up on the server, for PDF, not down on your machine when you open the PDF.

 

  This older handout from a NESUG presentation talked about how to store a customized template in the LEV1 folder used by the servers for a stored process. Here's the handout: https://support.sas.com/rnd/papers/regional08/SP_Template.pdf -- the paper was specifically talking about changing a tagset template, but could just as well have been changing a style template. In this presentation, I didn't need a custom style. but the concept is the same. You can deal with a custom style by getting permission from your SAS Administrator to run a job from a server that has write access to the Lev1 folder and you'll need to make sure your custom style template is written up there.

 

  Then, as shown in the handout, you'll need to alter your stored process code (in the handout it shows using the tagset template in _odsdest setting, but instead, you'd do your override for _odsstyle %LET statement:

libname lb_srv "<path to Lev1 folder where style template was created>";
** name of item store is lb_srv.templat, as an example;

ods path(prepend) lb_srv.templat(read);

%let _odsstyle = ** new style that lives in above path;
%let _odsdest = pdf;

%stpbegin;

*** rest of code;

%stpend;
ods path(remove) lb_srv.templat(read);

 

 

If you are using the EG Stored Process Wizard, you might have to turn off the automatic inclusion of the %STPBEGIN/%STPEND because you need to be sure that your libname statement for the template store and the ODS PATH(PREPEND) and the %LET statements all happen BEFORE the %STPBEGIN.

 

Hope this gets you pointed in the right direction.

 

Cynthia

DavidPhillips2
Rhodochrosite | Level 12

Cynthia,

 

To copy the template to the server:  Which local folder does Enterprise Guide create custom style manager templates in?  

Cynthia_sas
SAS Super FREQ

Hi: I don't think you can just copy the template to the server unless your system is the same as the server system. http://support.sas.com/kb/24/281.html So for example, you can't copy a Windows created template to Unix server. You need to have someone run the program on the server.

On my system, the EG templates are down on my C: drive here:
C:\Program Files (x86)\SASHome\x86\SASEnterpriseGuide\7.1\Styles


But your location may be different. And, the Workspace Server and Stored Process Server don't have EG, so they likely don't have a folder where you can stash a template. The Lev1 SAS Environment folder is a location designed to hold things like formats, macro programs, code snippets for %INCLUDE and other things (like style templates or tagset templates) that you may need to use in a Stored Process.

Cynthia

DavidPhillips2
Rhodochrosite | Level 12

Where do I place the .css / template file on the server to call it as a .css or template file?

Cynthia_sas
SAS Super FREQ
Hi: In the NESUG paper I posted above, I put it into the Lev1 folder where the formats and macro directories are also located. Your SAS Admin should be able to direct you to that location.

Otherwise, you have to find a network location where the CSS can be written 1 time and accessed by all the servers that will run the stored process.

Cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 896 views
  • 2 likes
  • 2 in conversation