@obvisou wrote:
I believe here exists a missunderstanding. If the user of the macro passes in a macro variable name that does not exist, then it should crash. There is no way, even defensive to do something. Otherwise you did not understand what my goal is. Again I need "only" this:
%let parameter_macrovariable = ¶meter_macrovariable. ¶meter_value.;
But because SAS is not so flexibel I have to find an other approach, a workaround. And it must be reusable for new variables, for new values. Hope now it is clear.
You posted something again about the if statement and I have to say again that this is not an issue. For testing you can trash the hole if-statement. If will still not work!
And if would be nice if we could concentrate on the same variable and values name. Otherwise it becomes confusing and error-prone.
I don't understand what you are saying.
The line you posted is adding a value to the macro variable named parameter_macrovariable
If the name of the macro variable does not change then you are done.
If you want the name of the macro variable to user defined then you could put the NAME into a macro variable. And the use the macro variable with the NAME to generate the %LET statement.
So these two statements will generate the same %LET statement as you showed.
%let name=parameter_macrovariable ;
%let &name = &&&name ¶meter_value.;
But there is a problem the macro I posted. Not with the macro variable name references, but with it trying to use FINDW() that way with %SYSFUNC(). SAS does not like the use of single space as one of the optional arguments. It is because %SYSFUNC() is trying to figure out if it should tell FINDW you are passing a numeric value or a character value. But you can leave the delimiter parameter empty and use the S modifier instead to tell FINDW() to use space as the delimiter.
%sysfunc(findw(&&&mvar,&value,,s))
... View more