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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—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.