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
Diamond | Level 26
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. 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 876 views
  • 2 likes
  • 5 in conversation