DATA Step, Macro, Functions and more

Passing Macro Variables From Macro to Macro

Accepted Solution Solved
Reply
Valued Guide
Posts: 588
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
‎02-14-2018 03:30 PM
Super User
Posts: 22,874

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
‎02-14-2018 03:30 PM
Super User
Posts: 22,874

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);


 

Valued Guide
Posts: 588

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
  • 103 views
  • 0 likes
  • 2 in conversation