BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
PaigeMiller
Diamond | Level 26

I am a beginner at PROC TEMPLATE. I follow the PROC TEMPLATE example here: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/odsproc/n1sbdyv873pfcmn1e3a8p2z4k055.htm and now my PROC FREQ shows the frequency counts in format comma12. Works as expected. But then, I want to do another PROC FREQ later in the same program with the default format for frequency counts, how do I return to the default format? Is it simply running PROC TEMPLATE again with the BEST7. format for frequency counts?

 

Is the some way to save the template with comma12. format and call it as needed?

--
Paige Miller
1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

If you followed the example then you probably used ODS PATH to add a "search" path for your custom templates. You can use ODS PATH with a REMOVE option to stop SAS from looking there, and bypass your custom template.

 

Best practice is to keep your custom templates in a location you control, and don't override the ones that ship with SAS (in the SASHELP location). 

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

View solution in original post

2 REPLIES 2
Cynthia_sas
Diamond | Level 26
Hi:
Basically, you need to create your changed template for PROC FREQ in a separate template store location. And then when you want to use the default template for PROC FREQ, you'll control the search path for the template stores by using an ODS PATH statement.
Take a look at this paper https://www.lexjansen.com/wuss/2009/tut/TUT-Zender.pdf -- I used the EDIT statement to create an edited template in WORK.SUMTEMP and because that was the first template store in the search path, anytime I use PROC MEANS, my changed template will be used. However, if I issue a new ODS PATH statement WITHOUT WORK.SUMTEMP in the path list, then the original template for PROC MEANS will be found.
When you are changing table templates associated with procedures, you cannot change the name of the table template that will be called by the procedure. All you can do is change the search path to find that template. That is what the ODS PATH statement allows you to do.
In practice, however, I rarely use a table template change for cosmetic things like formats or labels. Typically, I use ODS OUTPUT or the OUTPUT statement to create a data set and then I just use PROC PRINT or PROC REPORT to generate the final report with the formats/labels that I want.
Cynthia
ChrisHemedinger
Community Manager

If you followed the example then you probably used ODS PATH to add a "search" path for your custom templates. You can use ODS PATH with a REMOVE option to stop SAS from looking there, and bypass your custom template.

 

Best practice is to keep your custom templates in a location you control, and don't override the ones that ship with SAS (in the SASHELP location). 

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 840 views
  • 1 like
  • 3 in conversation