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

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
Obsidian | Level 7
I do mean observations but once they are read into the array they will become variables as input to the function.
Tom
Super User Tom
Super User

@Joe_O wrote:
I do mean observations but once they are read into the array they will become variables as input to the function.

https://xyproblem.info/

 

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
Obsidian | Level 7
Perhaps you're right. Would you advise creating a new topic or updating / replying within this one?
PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
PhilC
Rhodochrosite | Level 12

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;
Joe_O
Obsidian | Level 7
Decided to mark this as the solution since it is exactly what I was looking for and scaling it up was never realistic! Thanks for your help. This will definitely be useful in future.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 21 replies
  • 3532 views
  • 3 likes
  • 6 in conversation