BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
I have a macro variable and i cannot find where it is defined.. it appears in file names eg staging.credit_card_account_h_&yymmdd.

And before this file name appears, all I can see that is relating is
%macro genstage(yymmdd)

Is this macro statement also defining yymmdd as a macro variable?
3 REPLIES 3
Patrick
Opal | Level 21

"Is this macro statement also defining yymmdd as a macro variable?"

Intuitively yes, but we can of course not say without knowing what the macro does. 

Add the following options before the macro call:

options mprint symbolgen mautolocdisplay;

The mprint will print the macro definition to the SAS log, symbolgen will print to the log to what the macro variables resolve and mautolocdisplay will print where the macro is stored so you know where you can find the macro source code for further investigation.

 

PeterClemmensen
Tourmaline | Level 20

Yes. According to the %MACRO Macro Statement, the parameter list:

 

names one or more local macro variables whose values you specify when you invoke the macro. Parameters are local to the macro that defines them. You must supply each parameter name; you cannot use a text expression to generate it. A parameter list can contain any number of macro parameters separated by commas. The macro variables in the parameter list are usually referenced in the macro.

 

 

PaigeMiller
Diamond | Level 26

Maybe an oversight

 


@HeatherNewton wrote:

%macro genstage(yymmdd)


but that should have a semi-colon on the end, or it will generate an error and will not create a macro variable by that name.

 

%macro genstage(yymmdd);

 

 

--
Paige Miller

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
  • 3 replies
  • 1025 views
  • 0 likes
  • 4 in conversation