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. 

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
  • 963 views
  • 2 likes
  • 5 in conversation