BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
LB
Quartz | Level 8 LB
Quartz | Level 8

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

 


formats.jpg
1 ACCEPTED SOLUTION

Accepted Solutions
jklaverstijn
Rhodochrosite | Level 12

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.

View solution in original post

1 REPLY 1
jklaverstijn
Rhodochrosite | Level 12

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 1 reply
  • 2353 views
  • 0 likes
  • 2 in conversation