I have a question. I have defined some sas formats for different variables in a data set like for colon, stomach , digestive organs
eg. value liver 100=Basalcarciinoma, 200= Sarcoma etc
value stomach= .......................................
now I want to call all these format values at the same time in a data step in another program. Is there any way to do that?
I used
%include to bring the formats in the other program
normally one can then add to the data step eg.
data changedformats;
set dataiwanttochange;
if bodypart =liver then part=liver;
fomat part liver.;
run;
my question is how to I call all the format values at once like format liver. stomach. mouth. etc
Is there anyway to that?
So you have used PROC FORMAT somewhere in your program to create formats.
Later in the program, you want to use the formats. No %include is needed in this case.
my question is how to I call all the format values at once like format liver. stomach. mouth. etc
Is there anyway to that?
format livervariable liver. stomachvariable stomach. mouthvariable mouth. /* more variables and formats can be listed here if they exist */;
Okay, let me try that. Thanks a lot
I think this is what you are asking about ...
On the PROC FORMAT statement, the LIBRARY= option lets you permanently save the formats you create.
You can make those formats available by adding (in subsequent programs) the global option:
options fmtsearch= ..... ;
You will need to do a little research on both topics (saving, and retrieving).
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.