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!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.