BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
djbateman
Lapis Lazuli | Level 10

I have never used PROC TEMPLATE before, but I think it will come in quite handy.  I have started this week to explore its uses.  However, every time I attempt to run PROC TEMPLATE, I get an error.  I have even taken code by other and run it, but I always get the same error.  Below is an example of my code with the accompanying error:

proc template;

     define style MyStyle;

     parent=styles.Journal;

          replace fonts /

               'SASTitleFont' = ("Arial, Helvetica, Helv",2)

               'TitleFont2' = ("Arial, Helvetica, Helv",2,Bold)

               'TitleFont' = ("Arial, Helvetica, Helv",2,Bold)

     end;

run;

ERROR: Template 'MyStyle' was unable to write to template store!

     

I keep reading about something in sashelp.tmplmst.  That is not showing up in my sashelp directory.  Is there a special module that is required to run PROC TEMPLATE? 

Aside from my error message, I have also noticed that at times the word 'style' in my style statment turns red, but it is usually black.  Is 'style' a keywork that should turn blue like other keywords such as 'define' or 'end'?  This may be a topic for another discussion, so I will try to get the error message worked out first and come back if I still need help.

Thanks,

Dallas

1 ACCEPTED SOLUTION
8 REPLIES 8
djbateman
Lapis Lazuli | Level 10

That was such a simple fix.  Thank you so much!  This was really starting to get frustrating to me.

mathias
Quartz | Level 8

Hi,

And what should you do if you don't want to write in WORK ?

ods path reset;

ODS path show;

ODS path (PREPEND) COMMON.TEMPLAT(update);

ODS path (REMOVE) WORK.TEMPLAT;

ODS path show;

proc template;

      .....

end;

ERROR: Template 'XXX' was unable to write to template store!

Regards,

Tom
Super User Tom
Super User

Then you will need to manage release of the templates.

For example writing new templates to a new catalog and then scheduling copying to the master template store during off hours.

mathias
Quartz | Level 8

@Tom

Right, I figured it out in the same time, it releases the lock if you write a dummy template in WORK (after ODS device statement)

But no need to compile during off hours, I set the master TEMPLAT store to read-only as default for every user:

ODS path reset;

ODS path (PREPEND) a.TEMPLAT(READ);

and briefly to update mode when needed to be written to.

@Andre

We must have different environments,

My point was to ensure a.TEMPLAT was the only path in update mode.

THX !

Andre
Obsidian | Level 7

Mathias,

You are apparently making a mistake

From your code (but with a libref a in place of common)

=============================================

ods path reset;
ODS path show;
ODS path (PREPEND) a.TEMPLAT(update);
ODS path (REMOVE) WORK.TEMPLAT;
ODS path show;
proc template ;
define style styles.f;
   parent=styles.htmlblue;
  class table / rules=cols frame=void;
  end;
run;

ODS path (REMOVE) sasuser.TEMPLAT;
ODS path show;
ods path reset;
ODS path show;

=====================================================

The log shows no problems for writing a template,

but the first (remove) could not work as work.templat is in general not existing

38   ODS path (REMOVE) WORK.TEMPLAT;
NOTE: WORK.TEMPLAT is not currently in the ODS template path.
39
40   ODS path show;
Current ODS PATH list is:

1. A.TEMPLAT(UPDATE)
2. SASUSER.TEMPLAT(UPDATE)
3. SASHELP.TMPLMST(READ)

41   proc template ;
42   define style styles.f;
43      parent=styles.htmlblue;
44     class table / rules=cols frame=void;
45     end;
NOTE: STYLE 'Styles.F' has been saved to: A.TEMPLAT
46   run;
NOTE: PROCEDURE TEMPLATE used (Total process time):
      real time           0.04 secondes
      cpu time            0.00 secondes

47   ODS path (REMOVE) sasuser.TEMPLAT;
48   ODS path show;
Current ODS PATH list is:

1. A.TEMPLAT(UPDATE)
2. SASHELP.TMPLMST(READ)
49   ods path reset;
50   ODS path show;
Current ODS PATH list is:

1. SASUSER.TEMPLAT(UPDATE)
2. SASHELP.TMPLMST(READ)

The second (remove) is well acting

and you have to use the ods reset command to return to the by default environment

now to manage code of template, you have to use another piece of code

ODS path (PREPEND) a.TEMPLAT(update); *again;

proc template;
list /store=a.templat;
source styles.f/file="d:\temp\stylesfcode.sas";
run;

You see a result showing only the content of the a.templat store

2014-04-15_124721.png

then you have an external file with this contents :

======

define style Styles.F;
   parent = styles.htmlblue;
   class table /
      frame = void
      rules = cols;
end;

====

HTH

Andre

djrisks
Barite | Level 11

Thank you, this simple fix really helped me when I ran my SAS program on Unix! 🙂

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
  • 8 replies
  • 45781 views
  • 7 likes
  • 7 in conversation