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
Take a look at: http://support.sas.com/techsup/notes/v8/4/739.html
That was such a simple fix. Thank you so much! This was really starting to get frustrating to me.
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,
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.
@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 !
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
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
Thank you, this simple fix really helped me when I ran my SAS program on Unix! 🙂
If the link above does not work try this one: http://support.sas.com/techsup/notes/v8/4/739.html
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: