BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

Hello

I am trying to learn how to create a permanent user define format.

Please find the code below.

When I am trying to use this format I get an error.

" Format SMOKE was not found or could not be loaded."

 

 

Libname project  "/path/";
proc format library=project;
value smoke
.='missing'
1='current smoker'
2='former smoker'
3='never smoked'
;
run;
data aa;
input ID smokestatus;
cards;
1 1
2 1
3 2
;
run;
data bb;
set aa;
format smokestatus smoke.;
Run;
proc print data=bb noobs;run;
1 REPLY 1
Kurt_Bremser
Super User

When you put formats into another library than WORK, you need to adapt the FMTSEARCH system option accordingly.

Per default, SAS searches for formats in WORK and in a library called LIBRARY, if such exists (predefined formats in SASHELP are always searched, of course).

 

In your case you have to add

options fmtsearch=(work project);

before the format can be used successfully. Defining a library called LIBRARY and defining your permanent formats there would work without having to change the FMTSEARCH option.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 432 views
  • 1 like
  • 2 in conversation