Hello all;
So I am a little confused- I had created some formats in such way:
data F.locationxs (keep =fmtname start label ); /*format for Hospital codes to hosp names*/
length LABEL $ 91 ;
fmtname='$STATIT';
set statitcodes;
LABEL=XXX_NAME;
START=facid;
OUTPUT F.locationxs;
proc format cntlin=F.locationxs;run;
And saved it a permanent library-
Now when I run-
Libname fmtlib "/apps/sas/datasets/data76/NCQOS/data/FORMATS";
OPTIONS FMTSEARCH=(fmtlib.FORMATS);
It is really weird as I can access the formats in one program but not in the other-
Any reason for this?
I am running this through SAS EG on a linux platform.
Thanks
Lawrence
Hi Lawrence,
What FMTSEARCH actually does is point to a formats catalog that contains the formats you created. It sounds like you expect it to point to the dataset you created.
PROC FORMAT takes an input dataset through cntlin and creates what's called an entry (or entries) in a catalog. This catalog is called FORMATS by default and will be kept in a library, by default WORK. If the library is a permanent one you can point libname to it in a subsequent SAS session and have FMTSEARCH point to that catalog. Then your format will be available to that session and beyond.
Your code does not contain the option that directs PROC FORMAT to store the format in a catalog in a permanent library. So what you should do is add LIBRARY=fmtlib to the PROC FORMAT statetement. That will create the expected catalog in the permanent library. In a new session your FMTSEARCH option would give the desired result. The cntlin dataset, once used by PROC FORMAT to create the catalog entry, can in fact be discarded (or kept for future reference). It can always be recreated with the inverse of CNTLIN, the CNTLOUT option.
If with this in mind, you read the SAS doc on the subject it should become crystal clear and you have gained yet another bit of the power to know.
Hope this helps,
- Jan.
Hi Lawrence,
What FMTSEARCH actually does is point to a formats catalog that contains the formats you created. It sounds like you expect it to point to the dataset you created.
PROC FORMAT takes an input dataset through cntlin and creates what's called an entry (or entries) in a catalog. This catalog is called FORMATS by default and will be kept in a library, by default WORK. If the library is a permanent one you can point libname to it in a subsequent SAS session and have FMTSEARCH point to that catalog. Then your format will be available to that session and beyond.
Your code does not contain the option that directs PROC FORMAT to store the format in a catalog in a permanent library. So what you should do is add LIBRARY=fmtlib to the PROC FORMAT statetement. That will create the expected catalog in the permanent library. In a new session your FMTSEARCH option would give the desired result. The cntlin dataset, once used by PROC FORMAT to create the catalog entry, can in fact be discarded (or kept for future reference). It can always be recreated with the inverse of CNTLIN, the CNTLOUT option.
If with this in mind, you read the SAS doc on the subject it should become crystal clear and you have gained yet another bit of the power to know.
Hope this helps,
- Jan.
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!
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.