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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.