BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Emjay
Obsidian | Level 7

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?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

THe list is in the Dictionary table, which you can access and count.

 

SASHELP.VMACRO is the name of the table.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

THe list is in the Dictionary table, which you can access and count.

 

SASHELP.VMACRO is the name of the table.

--
Paige Miller
Emjay
Obsidian | Level 7

Wow, thanks for the quick help!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1268 views
  • 3 likes
  • 2 in conversation