Victor
Victor

Reputation: 17107

Where are the SAS formats defined?

When I start up my SAS session and define a library to a folder:

LIBNAME testlib "C:\DATA\&YRMTH\TEST\";

When I navigate to testlib, I already see a bunch of formats defined and ready to use. I am not sure where they are defined and I cannot find them. I need to edit one of these formats, how do I locate the source? YRMTH is a macro variable that contains YYYYMM, corresponding to today's date.

Upvotes: 1

Views: 235

Answers (1)

Richard
Richard

Reputation: 27518

Proc FORMAT source code is not stored with the resultant created format catalog entry.

A format catalog in one of your own libraries can be added to the format search path using the option. From Usage Note 23007: How can I permanently store and use formats that I have created?

OPTIONS FMTSEARCH=(catalog-specification-1... catalog-specification-n);

You may be in a situation where you never find the original source code that created the format! However, all is not lost. The control data of a custom format can extracted using PROC FORMAT CNTLOUT=. A custom format can be edited by manipulating the extracted control data and running it back into with PROC FORMAT CNTLIN= to recreate (overwriting) the original custom format. Remember, that could be a non-reversible process if you do not take care to backup or archive your catalog, catalog entry or extracted control data.

Not sure how your macro variable gets involved with a discussion of formats. Update the question if there is more information to share.

Upvotes: 1

Related Questions