DATA Step, Macro, Functions and more

Passing Macro Variables From Macro to Macro

Accepted Solution Solved
Reply
Valued Guide
Posts: 531
Accepted Solution

Passing Macro Variables From Macro to Macro

I’m googing how to pass a variable from one macro to another and having a hard time finding good documentation on it.  Concept code is below:

Please advise:

 

%macro createYearsOuter(yearVar);
%CreateYears(&yearVar, 'S');
%CreateYears(&yearVar, 'F');
%mend;

 

%createYearsOuter(1617);
%createYearsOuter(1516);


Accepted Solutions
Solution
a week ago
Super User
Posts: 21,546

Re: Passing Macro Variables From Macro to Macro

Posted in reply to DavidPhillips2

That should work fine, but I'm partial to CALL EXECUTE these days. 

Is there something there not working?

 


DavidPhillips2 wrote:

I’m googing how to pass a variable from one macro to another and having a hard time finding good documentation on it.  Concept code is below:

Please advise:

 

%macro createYearsOuter(yearVar);
%CreateYears(&yearVar, 'S');
%CreateYears(&yearVar, 'F');
%mend;

 

%createYearsOuter(1617);
%createYearsOuter(1516);


 

View solution in original post


All Replies
Solution
a week ago
Super User
Posts: 21,546

Re: Passing Macro Variables From Macro to Macro

Posted in reply to DavidPhillips2

That should work fine, but I'm partial to CALL EXECUTE these days. 

Is there something there not working?

 


DavidPhillips2 wrote:

I’m googing how to pass a variable from one macro to another and having a hard time finding good documentation on it.  Concept code is below:

Please advise:

 

%macro createYearsOuter(yearVar);
%CreateYears(&yearVar, 'S');
%CreateYears(&yearVar, 'F');
%mend;

 

%createYearsOuter(1617);
%createYearsOuter(1516);


 

Highlighted
Valued Guide
Posts: 531

Re: Passing Macro Variables From Macro to Macro

Reeza, thanks for pointing out that the code works.  I thought it wasn't due to a different error.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 79 views
  • 0 likes
  • 2 in conversation