I'm defining a variable number of macro variables that I want to use later in my program.
The number of those user-defined macro variables will also be a parameter later.
So let's say:
%let Opt1= 'abcd' 'efgd'; %let Opt2= 'abascd' 'efgretd'; %let Opt3= 'abgfcd' 'eqqwfgd'; %let Count_Opt=3; /* I don't want to do this manually. */
Is there a way to write those variables in a list and count this number then?
The only thing I found was the
%put _user_;
statement to see all my defined variables but this writes to the log only. And even if I could manage to acces this list, I need to somehow just get that variables that start with "Opt".
Is there a way or do I have to stick to manually defining this number?
THe list is in the Dictionary table, which you can access and count.
SASHELP.VMACRO is the name of the table.
THe list is in the Dictionary table, which you can access and count.
SASHELP.VMACRO is the name of the table.
Wow, thanks for the quick help!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.