BookmarkSubscribeRSS Feed
JasonL
Quartz | Level 8

Can somebody explain what the following statement does?

 

%mBuildLookupTab1(NAME=Region_Code_Conversion,DATASET=MyData.CCAC_LHIN,KEY=Region_ID,OBJ1=Region_Code);

5 REPLIES 5
PaigeMiller
Diamond | Level 26

It executes a SAS macro named %mBuildLookupTab1 (so someone has previously created this macro, and possibly stored it in a location from which it will be called), with arguments NAME, DATASET, KEY and OBJ1 taking on the values shown.

--
Paige Miller
JasonL
Quartz | Level 8

Ok thanks.

Cynthia_sas
Diamond | Level 26

Hi:

  This code is invoking a SAS macro program definition named %mBuildLookupTab1. Someplace, there should be code that has this:

 

%macro mBuildLookupTab1();

 

...... more code .....

 

%mend;

 

The "more code" is what gets executed when the macro program is invoked. Within the parentheses in the macro definition and the macro invocation are macro parameters: NAME, DATASET, KEY, and OBJ1. Inside the %MACRO definition, the parameters are being defined. In the "more code", the macro parameters should be visible as their macro variable equivalents: &NAME, &DATASET, &KEY, and &OBJ1. Without knowing more about what is in the "more code" in the macro definition program, it's nearly impossible to tell what is happening in the macro program when it is executed.

 

  You can turn on

options MPRINT SYMBOLGEN;

 

to see what the macro program is doing when you run it.

 

  Hope this helps,

Cynthia

JasonL
Quartz | Level 8

Thanks a lot Cynthia!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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