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!

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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