BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi all,

I am trying to write a macro function that produces combination of strings within a macro variable

For instance when
1.Macr_var = a;
Then call
%calc(a);

2.Macr_var = a b;

Then call

%calc(a b);
%calc(a);
%calc(b);


3. Macr_var = a b c;

Then call

%calc(a b c);
%calc(a);
%calc(b);
%calc(c);
%calc(a b);
%calc(a c);
%calc(b c);

4. Macr_var = a b c d;
Then call

%calc(a b c d);
%calc(a);
%calc(b);
%calc(c);
%calc(d);
%calc(a b);
%calc(a c);
%calc(a d);
%calc(b c);
%calc(b d);
%calc(c d)
%calc(a b d);
%calc(a c d);
%calc(b c d);

I was thinking of using do loops but it seems very confusing on how to implement something like this in loops.

Would be great if you guys could provide some kind of algorithm that I could use

Thanks,

L
1 REPLY 1
data_null__
Jade | Level 19
SAS has all the tools you need look a COMB and LEXCOMB functions/call routines.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 724 views
  • 0 likes
  • 2 in conversation