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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 21 replies
  • 2768 views
  • 3 likes
  • 6 in conversation