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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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