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

Hi,

How to save proc formats permanently and how to use those created user defined formats on datasets?

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User
Direct your PROC FORMAT to write to a library where you have write permission. Add this library to your FMTSEARCH option in your autoexec (depends on the user interface - SAS Studio, Enterprise Guide, Display Manager - you use).

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User
Direct your PROC FORMAT to write to a library where you have write permission. Add this library to your FMTSEARCH option in your autoexec (depends on the user interface - SAS Studio, Enterprise Guide, Display Manager - you use).
Tom
Super User Tom
Super User

You can save formats into format catalogs by telling PROC FORMAT what catalog to use with the LIBRARY= option of the PROC FORMAT statement.

 

You can either tell just the libref of the library to write into, in which case the catalog names will be FORMATS.  Or you can give it the full two level name of the catalog.

 

Once the formats exist in a catalog to re-use them you need to make sure the FMTSEARCH option includes that format catalog.

 

Let's say you want to store the formats into the same library as the datasets.

Then the structure of your code to create the format library and the datasets might look like this:

libname mylib 'physical path';
options insert=fmtsearch=(mylib);
proc format library=mylib;
value fmta ....;
...
run;
data mylib.myds ;
  .....
  format var1 var4 var5 fmta. ;
run;

Then when you want to use that dataset in another session you just need to first repeat the first two lines so that the libref is defined and the FMTSEARCH option includes the format catalog.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1149 views
  • 4 likes
  • 3 in conversation