The SAS Output Delivery System and reporting techniques

Proc Template error when executing from Unix command line

Frequent Contributor
Posts: 94

Proc Template error when executing from Unix command line

I am getting am getting this error when I execute my code from unix command line,  It runs fine when executing in SAS Enterprise Guide.  How can I resolve this.  Our report all execute from the command line.  Thanks, Cindy

74        proc template;

475        define style styles.XLsansPrinter;

476 parent = styles.sansPrinter;

477 style header from header /

478 font_face = "Arial, Helvetica"

479 font_size = 10pt

480 font_weight = bold

481 font_style = roman

482 foreground = cx000000

483 background = #99ccff

484 just = center

485 vjust = bottom;

486 end;

ERROR: Template 'Styles.XLsansPrinter' was unable to write to template store!

487 run;

NOTE: PROCEDURE TEMPLATE used (Total process time):

real time           0.02 seconds

cpu time            0.02 seconds


WARNING: Errors were produced.

NOTE: The SAS System stopped processing this step because of errors.

Posts: 9,371

Re: Proc Template error when executing from Unix command line

Hi, Generally, in Enterprise Guide, you have write access to SASUSER.TEMPLAT, which is automatically available for writing templates. However, in a server configuration, it is possible that the way you invoke SAS from the command line is routing you to a configuration where the SASUSER library is not available for WRITE access. The ODS PATH statement allows you to declare a location for the changed template and then you can also use STORE= to direct the template to a specific location where you know you have write access (if for example, you have more than one template store with write access). For example:

libname main '/user/bin/main/stuff';

libname bkup '/user/bin/bkup/morestuff';

ods path main.templat(update) bkup.templat(update) sashelp.tmplmst(read);

*** proc template code;

*** other code;

In this instance, without STORE=, the changed template would get written to the MAIN.TEMPLAT item store because it is listed first in the list. But with STORE= and 2 write-able item stores in the path, then you could direct your changed template to BKUP.TEMPLAT, if you wanted. Most people only have the default to start with, which usually is:

sasuser.templat(update) sashelp.tmplmst(read) -- but if your server SAS doesn't allow you write access to SASUSER (which might happen because in batch mode, you really don't need SASUSER), then taking control with an ODS PATH statement might be required.

And, of course, you will probably have to work with someone to get a location with write access and get the folder name correct for the LIBNAME statement.

BTW, never, ever, ever, ever, ever, ever, ever, ever define SASHELP.TMPLMST with any access other than READ -- you do not want to clobber the SAS-defined templates.


Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation