BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
If I create macro e.g. %macro(source, file,ID), does it automatically define source, file and id as macro variable as I see &source and dont see a statement declarinf source as macro variable..
4 REPLIES 4
Tom
Super User Tom
Super User

If you DEFINE a macro name MYMACRO with a statement like:

%macro mymacro(source, file,ID);

Then the macro's parameters ( SOURCE, FILE and ID) will all be LOCAL macro variables.

 

Try it:

943  %macro mymacro(source, file,ID);
944  %put _local_;
945  %mend mymacro;
946  %mymacro;
MYMACRO FILE
MYMACRO ID
MYMACRO SOURCE

 

Cynthia_sas
SAS Super FREQ
Hi: This paper may help you get started understanding SAS Macro program parameters and how to define them and how to use them: https://support.sas.com/resources/papers/proceedings13/120-2013.pdf

Cynthia
Reeza
Super User

@HeatherNewton wrote:
 dont see a statement declarinf source as macro variable..

Variables and macro variables do not have to be declared in SAS. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 457 views
  • 2 likes
  • 5 in conversation