BookmarkSubscribeRSS Feed
SAS_user_n
Calcite | Level 5
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!
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 802 views
  • 0 likes
  • 2 in conversation