DATA Step, Macro, Functions and more

calling sas formats

Reply
Contributor
Posts: 60

calling sas formats

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?

Respected Advisor
Posts: 2,994

Re: calling sas formats

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 */;
--
Paige Miller
Contributor
Posts: 60

Re: calling sas formats

Okay, let me try that. Thanks a lot

Super User
Posts: 6,756

Re: calling sas formats

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

Ask a Question
Discussion stats
  • 3 replies
  • 62 views
  • 0 likes
  • 3 in conversation