BookmarkSubscribeRSS Feed
JayyA
New User | Level 1

Hi,

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

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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 93 views
  • 2 likes
  • 3 in conversation