BookmarkSubscribeRSS Feed
Anita_n
Pyrite | Level 9

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?

3 REPLIES 3
PaigeMiller
Diamond | Level 26

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
Anita_n
Pyrite | Level 9

Okay, let me try that. Thanks a lot

Astounding
PROC Star

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

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1441 views
  • 0 likes
  • 3 in conversation