DATA Step, Macro, Functions and more

output from macro as an input to another macro

Reply
Occasional Contributor
Posts: 15

output from macro as an input to another macro

I would like to have call a macro as an input to another macro, and am wondering if there is a good way to do that?

For example, I have %macro1 that transforms a variable and renames it.

%macro1(input1=raw_variable)
==> output is renamed_raw_var

I want to write another %macro2 that takes in "renamed_raw_var" and makes the lags of the variable based on the type of the variable.

%macro2(input2=renamed_raw_var)

Finally, can I do this ? %macro2(input2=%macro1(input1=raw_variable) )

which I tried but did not work. Any suggestion would be greatly appreciated.

Thanks!
Super Contributor
Super Contributor
Posts: 3,174

Re: output from macro as an input to another macro

There is no "lag" type function for macro variables - suggest you track "n" unique macro variable values as "MyMacroVar1" through "MyMacroVar99" or however many you need to run through.

It would be more useful to explain what you are attempting to accomplish for beneficial feedback from the forum subscribers, particularly how you start the process, then each iterative step, working through to the final objective / output.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 1 reply
  • 118 views
  • 0 likes
  • 2 in conversation