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;
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.
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.
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.