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. 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 385 views
  • 2 likes
  • 5 in conversation