Skip to content

noNestedMacros #16

@allanbowe

Description

@allanbowe

If a SAS macro is defined like so:

%macro outer();
  /* any amount of arbitrary code */
  %macro inner();
    %put inner;
  %mend;
  %inner()
  %put outer;
%mend;

%outer()

This is widely considered as bad practice, because the inner definition is recompiled every time the outer macro is invoked.

We should create a lint warning if a subsequent %macro is discovered before a %mend in a SAS program.

For reference, a more 'correct' way to have defined the above would have been:

%macro inner();
   %put inner;
%mend;
%macro outer();
  /* any amount of arbitrary code */
  %inner()
  %put outer;
%mend;

%outer()

Rule name: noNestedMacros

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions