Wow,
~100 variables. Cases like these are when I've found its nice to learn computer science. You'll never forget that first time you unknowingly start down a rabbit hole that needs O(n!) time. Asymptotic computational complexity - Wikipedia
@Joe_O wrote:
I do mean observations but once they are read into the array they will become variables as input to the function.
Perhaps you should explain the real problem you are trying to solve. There might already be a SAS procedure that has been optimized for this.
@Joe_O wrote:
I do mean observations but once they are read into the array they will become variables as input to the function.
The above statement (and really all your statements) still does not have enough meaning to turn into a program, in my opinion. I still look forward to seeing a clear and complete problem description, with sample input data (in the format requested earlier) and step-by-step description of how the variable COMBINATION is created.
I liked this problem. I learned about a new function: lexperm I hope this adds to the discussion, even though you've found a solution,
data temp;
array y_[3] $1 y1-y3 ('1' '2' '3' );
nfact=fact(3); drop nfact;
do i=1 to nfact;
rc=lexperm(i, of y_[*]);
drop rc;
if rc<0 then leave;
output;
end;
run;
data want (Keep=Combination x y);
set temp;
array y_[3] y1-y3;
Combination="Combination"||put(i,1.0);
do x=1 to 3;
y=y_[x];
output;
end;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.