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