Is PROC FORMAT statement GLOBAL statement?
Because, we can use value statement in any data step statement.
Thank You.
Hi: Just a clarification. Once you define a user-defined FORMAT, using a VALUE, INVALUE or PICTURE statement, within a PROC FORMAT step, you can use the format NAME on a FORMAT statement within a DATA step program. However, you cannot use a VALUE statement in a DATA step program, as shown below:
However, when you define a format within a PROC FORMAT step, as shown below:
Then you CAN use a FORMAT statement to associate the format name with a specific variable in your program.
Cynthia
The answer might be a sort of "maybe".
The LIBRARY option on a proc format statement indicates where a format may be stored. If Library is not specified then that would be the WORK library.
You have a SAS option call FMTSEARCH which tells SAS where to search for formats and the order to search the libraries.
This code will show the current setting you have as a Log entry:
proc options option=fmtsearch;run;
You use the Options statement to assign or modify the FMTSEARCH order such as
options fmtsearch=(WORK SASHELP OLDLIB); would assign these three libraries to the search path.
Options append(fmtsearch= NewLIb); would add NEWLIB to the end of the current FMTSEARCH order, Insert would place it at the beginning of the search order.
If you specify a library on the PROC Format statement and do not add it to the FMTSEARCH path then the formats there cannot be found. If the library is not assigned at the time the format is used then the format cannot be found.
One proc format creates a format in a library on the current fmtsearch path the format may be used anywhere in the SAS session.
With the default library of WORK and WORK almost always in the FMTSEARCH option then formats are generally available as long as the Proc Format code is run in every session.
All this stuff related to libraries is because some organizations have many custom formats and creating permanent formats in a known location users can reference means they do not have to run the code to recreate all of the formats in each session. These organization also usually have settings in the SAS set up to set the FMTSEARCH to reference the libraries.
Hi: Just a clarification. Once you define a user-defined FORMAT, using a VALUE, INVALUE or PICTURE statement, within a PROC FORMAT step, you can use the format NAME on a FORMAT statement within a DATA step program. However, you cannot use a VALUE statement in a DATA step program, as shown below:
However, when you define a format within a PROC FORMAT step, as shown below:
Then you CAN use a FORMAT statement to associate the format name with a specific variable in your program.
Cynthia
Hi, again
I understand.
so, PROC FORMAT statement, in VALUE stat.
We can use any of the SAS dataset or file in SAS any session. Just run, PROC FORMAT stat. and use any where we want.
Thank You.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.