I am running that the following code and I am getting the error above. The collateral macro seems to compile correctly and the increment variable assumes the correct valued; am I missing smth. Why am I getting this error when trying to run the %main macro?
%main();
%macro main();
%let increment=25000;
%collateral(&increment);
%mend main();
-Maroulator
And you can specify the parameter names for the positional parameters also in the macro call allowing you to list them in any order you want.
%dummy(var4=value4,var1=value1,var2=value2,var3=value3)
You probably have some unbalanced quotes or parentheses somewhere and SAS is in a confused state. Start a new session to get a fresh slate and see if it goes away.
You seem to want to call the macro MAIN before it is defined, but that could just be the way the code got pasted into the posting.
Otherwise there must be something happening in the COLLATERAL macro. Try just calling it directly and see if you still get the same error.
The most likely problem is that COLLATERAL is defined with named parameters and you are calling it with positional.
For example try this simple test to generate the same problem.
%macro mymac(x=);
%put x="&x";
%mend mymac;
%mymac(100);
If you want to be able to call the macro without specifying the parameter names in the call then do not include the equal signs after the parameter names in the %MACRO statement.
Note that you can still call positional parameters using named syntax, you just can't do it the other way.
And all positional parameters have to come before named.
%macro dummy(var1, var2, var3= , var4=); in definition and
use
%dummy (value1, value2, var3=value3, var4=value4); the order or presence of var3 and var4 are optional as long as they come after var1 and var2.
And you can specify the parameter names for the positional parameters also in the macro call allowing you to list them in any order you want.
%dummy(var4=value4,var1=value1,var2=value2,var3=value3)
As a side note, check the value you are passing in to you macros (Outer / Inner) either.
If the string value you passing happens to have a comma (,) in it, such as formatted numeric value, or single character value containing a comma.
In order to avoid issues with commas and other special characters that could exists in your data, try to use the following macro functions (%str(), %nrtstr(), %superq()) instead of using the bare &[Var] format.
This is applicable to positional and named macro parameters.
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.
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.