<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Find all possible groups of pairs of two variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711127#M218997</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/363790"&gt;@Joe_O&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks so much for this solution- it is precisely what I'm looking for except for one thing - the ALLPERM function has a limit of 18 variables and I will need ~100. I should have specified in my original post. Is there a method that does not use this function?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Given that 18!=6,402,373,705,728,000, I can understand why there is that limit. Are there so many duplicate values (available for elimination) among those ~100 that the number of 100!=9.3E157 bijections would be reduced substantially?&lt;/P&gt;</description>
    <pubDate>Wed, 13 Jan 2021 14:38:46 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2021-01-13T14:38:46Z</dc:date>
    <item>
      <title>Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711056#M218968</link>
      <description>&lt;P&gt;I have a dataset containing two numeric variables. I want to find every possible combination of pairs of these variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that I am not asking for all possible combinations of the two variables (eg. I could find this by performing a cross join). I want all possible combinations of each pair. For example, if the two variables just had 3 values each (1,2,3), I'd want something like the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Combination1 = 1&amp;amp;1 2&amp;amp;2 3&amp;amp;3&lt;/P&gt;&lt;P&gt;Combination2 = 1&amp;amp;1 2&amp;amp;3 3&amp;amp;2&lt;/P&gt;&lt;P&gt;Combination3 = 1&amp;amp;2 2&amp;amp;3 3&amp;amp;1&lt;/P&gt;&lt;P&gt;etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using proc transpose to create a matrix but couldn't think of a way to systematically move through the matrix recording each combination. Feels like it's solvable using a 2 dimensional array but I can't quite come up with the solution!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 12:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711056#M218968</guid>
      <dc:creator>Joe_O</dc:creator>
      <dc:date>2021-01-13T12:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711064#M218973</link>
      <description>&lt;P&gt;I'm not quite sure what your desired result looks like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suppose your data looks like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x y;
datalines;
1 1
2 2
3 3
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What does your desired result look like?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 13:04:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711064#M218973</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-13T13:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711066#M218974</link>
      <description>&lt;P&gt;Here's a do-loop in a DATA step solution. I assume in this case the numbers are consecutive, starting with 1 and ending with ENDNUM (which is a variable you can set, in this case I have set it to 4);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    length string $ 8;
    endnum=4;
    do i=1 to endnum;
        do j=(i+1) to endnum;
            string =cats(i,',',j);
            output;
        end;
    end;
    drop endnum;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Naturally, this can be made more flexible if you need to do this for non-consecutive numbers , or if the values don't start with 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 13:13:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711066#M218974</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-13T13:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711083#M218981</link>
      <description>&lt;P&gt;Thanks for the reply. Sorry for not being more specific. I'm not particular about the exact structure as long as it is usable but something like the below would be ideal. Where x and y are the input variables as you suggested and Combination is the variable created by the program.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Combination&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;x&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;y&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Combination1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&g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;&lt;TR&gt;&lt;TD&gt;Combination6&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Combination6&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Combination6&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that x and y are only used once per "combination" and each "combination" uses all values of x and y.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 13:40:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711083#M218981</guid>
      <dc:creator>Joe_O</dc:creator>
      <dc:date>2021-01-13T13:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711085#M218982</link>
      <description>Thanks for the reply. Your assumptions are correct however, I am looking for distinct groups of each combination rather than just the combinations themselves. I realise I might not have explained it particularly well but hopefully my other reply makes sense!</description>
      <pubDate>Wed, 13 Jan 2021 13:42:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711085#M218982</guid>
      <dc:creator>Joe_O</dc:creator>
      <dc:date>2021-01-13T13:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711086#M218983</link>
      <description>Just realise I missed "Combination4" but hopefully that makes sense!</description>
      <pubDate>Wed, 13 Jan 2021 13:44:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711086#M218983</guid>
      <dc:creator>Joe_O</dc:creator>
      <dc:date>2021-01-13T13:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711096#M218986</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/363790"&gt;@Joe_O&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the reply. Sorry for not being more specific. I'm not particular about the exact structure as long as it is usable but something like the below would be ideal. Where x and y are the input variables as you suggested and Combination is the variable created by the program.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG&gt;Combination&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;STRONG&gt;x&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;STRONG&gt;y&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Combination1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Combination1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Combination1&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Combination2&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD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t;3&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that x and y are only used once per "combination" and each "combination" uses all values of x and y.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't really understand this. Can you show us just the input data (following &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;&amp;nbsp;so we can have a data set to work from — I will not use data provided in other forms) and then explain how you derive the variable named COMBINATION?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 14:01:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711096#M218986</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-13T14:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711097#M218987</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/363790"&gt;@Joe_O&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create sample data for demonstration */

data have;
do x=1 to 4;
  y=x; output;
end;
run;

/* Determine number of observations in HAVE */

data _null_;
call symputx('n',n);
stop;
set have nobs=n;
run;

/* Create the combinations of pairs */

data want(keep=comb x y);
length comb 8;
array _x[&amp;amp;n] _temporary_;
array _y[&amp;amp;n] _temporary_;
set have end=last;
_x[_n_]=x;
_y[_n_]=y;
if last;
do comb=1 to fact(&amp;amp;n);
  _c=allperm(comb, of _y[*]);
  do _i=1 to &amp;amp;n;
    x=_x[_i]; y=_y[_i]; output;
  end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The result can be reported in a wide structure if needed:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
length combpairs $25; /* adapt length appropriately */
do until(last.comb);
  set want;
  by comb;
  combpairs=catx(' ',combpairs,cats('(',x,',',y,')'));
end;
put comb 3. +2 combpairs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;  1  (1,1) (2,2) (3,3) (4,4)
  2  (1,1) (2,2) (3,4) (4,3)
  3  (1,1) (2,4) (3,2) (4,3)
  4  (1,4) (2,1) (3,2) (4,3)
  5  (1,4) (2,1) (3,3) (4,2)
...
 24  (1,2) (2,1) (3,3) (4,4)&lt;/PRE&gt;
&lt;P&gt;Edit: If x&lt;SUB&gt;1&lt;/SUB&gt;, ..., x&lt;SUB&gt;n&lt;/SUB&gt; are the values of the first variable and y&lt;SUB&gt;1&lt;/SUB&gt;, ..., y&lt;SUB&gt;n&lt;/SUB&gt; are the values of the second variable, the code creates all n! &lt;STRONG&gt;bijections of the set {1, ..., n} to itself&lt;/STRONG&gt; and writes the corresponding pairs (x&lt;SUB&gt;i&lt;/SUB&gt;, y&lt;SUB&gt;j&lt;/SUB&gt;) together with the sequence number 1, ..., n! of the combination (=bijection) to the output dataset. Note that duplicates will occur (but could be eliminated) if there are duplicate values in either variable.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 14:24:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711097#M218987</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-01-13T14:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711117#M218993</link>
      <description>Thanks so much for this solution- it is precisely what I'm looking for except for one thing - the ALLPERM function has a limit of 18 variables and I will need ~100. I should have specified in my original post. Is there a method that does not use this function?</description>
      <pubDate>Wed, 13 Jan 2021 14:29:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711117#M218993</guid>
      <dc:creator>Joe_O</dc:creator>
      <dc:date>2021-01-13T14:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711122#M218995</link>
      <description>My data has hundreds of observations but the datalines statement you posted is fine as a smaller example.&lt;BR /&gt;&lt;BR /&gt;The Combination variable is just a name given to each group of pairs. Once the program has identified a combination of pairs, it just needs to give them a name so that they can be grouped later on.</description>
      <pubDate>Wed, 13 Jan 2021 14:33:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711122#M218995</guid>
      <dc:creator>Joe_O</dc:creator>
      <dc:date>2021-01-13T14:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711126#M218996</link>
      <description>&lt;P&gt;I liked this problem.&amp;nbsp; I learned about a new function:&amp;nbsp;&lt;CODE class=" language-sas"&gt;lexperm&lt;/CODE&gt;&amp;nbsp; I hope this adds to the discussion, even though you've found a solution,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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&amp;lt;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;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Jan 2021 14:37:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711126#M218996</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-01-13T14:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711127#M218997</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/363790"&gt;@Joe_O&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks so much for this solution- it is precisely what I'm looking for except for one thing - the ALLPERM function has a limit of 18 variables and I will need ~100. I should have specified in my original post. Is there a method that does not use this function?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Given that 18!=6,402,373,705,728,000, I can understand why there is that limit. Are there so many duplicate values (available for elimination) among those ~100 that the number of 100!=9.3E157 bijections would be reduced substantially?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 14:38:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711127#M218997</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-01-13T14:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711128#M218998</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/363790"&gt;@Joe_O&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks so much for this solution- it is precisely what I'm looking for except for one thing - the ALLPERM function has a limit of 18 variables and I will need ~100. I should have specified in my original post. Is there a method that does not use this function?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you mean ~100 observations, or do you mean ~100 variables?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 14:39:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711128#M218998</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-13T14:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711130#M218999</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/363790"&gt;@Joe_O&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;My data has hundreds of observations but the datalines statement you posted is fine as a smaller example.&lt;BR /&gt;&lt;BR /&gt;The Combination variable is just a name given to each group of pairs. Once the program has identified a combination of pairs, it just needs to give them a name so that they can be grouped later on.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'm afraid this is not an explanation that I can use to provide programming for. How? How do you assign a value to combination? Is it random? Is there some process? If there is a process, we need step-by-step details of that process in order to turn it into a program.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 14:41:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711130#M218999</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-13T14:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711134#M219000</link>
      <description>&lt;P&gt;Wow,&lt;/P&gt;
&lt;P&gt;~100 variables.&amp;nbsp; Cases like these are when I've found its nice to learn computer science.&amp;nbsp; You'll never forget that first time you unknowingly start down a rabbit hole that needs O(&lt;FONT face="times new roman,times" size="4"&gt;&lt;EM&gt;n&lt;/EM&gt;&lt;/FONT&gt;&lt;FONT face="times new roman,times"&gt;!&lt;/FONT&gt;) time.&amp;nbsp;&amp;nbsp;&lt;A href="https://en.wikipedia.org/wiki/Asymptotic_computational_complexity" target="_blank" rel="noopener"&gt;Asymptotic computational complexity - Wikipedia&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 14:50:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711134#M219000</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-01-13T14:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711143#M219005</link>
      <description>No duplicates. Both variables will literally just be the number 1 to 100 (or whatever the limit is).&lt;BR /&gt;&lt;BR /&gt;Perhaps I didn't think about how realistic this would be!&lt;BR /&gt;&lt;BR /&gt;I think I will be able to reduce the list of possible pairs down. For example, if my list goes up to 10, I could say&lt;BR /&gt;&lt;BR /&gt;x=1 may only be paired with y= 3,5 or 7".&lt;BR /&gt;x=2 may only be paired with y= 1,5,8 or 9".&lt;BR /&gt;&lt;BR /&gt;Obviously, I'd have to alter the input. I expect this will add to the complexity of the solution but would this make it more feasible? How would you proceed?</description>
      <pubDate>Wed, 13 Jan 2021 15:01:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711143#M219005</guid>
      <dc:creator>Joe_O</dc:creator>
      <dc:date>2021-01-13T15:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711146#M219007</link>
      <description>I do mean observations but once they are read into the array they will become variables as input to the function.</description>
      <pubDate>Wed, 13 Jan 2021 15:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711146#M219007</guid>
      <dc:creator>Joe_O</dc:creator>
      <dc:date>2021-01-13T15:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711148#M219008</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/363790"&gt;@Joe_O&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I do mean observations but once they are read into the array they will become variables as input to the function.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="https://xyproblem.info/" target="_blank"&gt;https://xyproblem.info/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you should explain the real problem you are trying to solve.&amp;nbsp; There might already be a SAS procedure that has been optimized for this.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 15:08:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711148#M219008</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-13T15:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711150#M219010</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/363790"&gt;@Joe_O&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I do mean observations but once they are read into the array they will become variables as input to the function.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;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 &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;format&lt;/A&gt; requested earlier) and step-by-step description of how the variable COMBINATION is created.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2021 15:15:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711150#M219010</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-13T15:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Find all possible groups of pairs of two variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711153#M219012</link>
      <description>Perhaps you're right. Would you advise creating a new topic or updating / replying within this one?</description>
      <pubDate>Wed, 13 Jan 2021 15:18:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-all-possible-groups-of-pairs-of-two-variables/m-p/711153#M219012</guid>
      <dc:creator>Joe_O</dc:creator>
      <dc:date>2021-01-13T15:18:20Z</dc:date>
    </item>
  </channel>
</rss>

