<?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: Combination and permutation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285887#M58541</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/90536"&gt;@sdixit&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;it is any number then flag ="y" . Varibale can have&amp;nbsp;single digit or string of digits.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then solution above should work, given your stated requirements.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jul 2016 17:11:05 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-07-20T17:11:05Z</dc:date>
    <item>
      <title>Combination and permutation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285312#M58296</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please let me know how to create a table having&lt;/P&gt;&lt;P&gt;all combination and permutation of &amp;nbsp;(8,9-,9,9+,10) 5 numbers&lt;/P&gt;&lt;P&gt;taken 1, 2, 3, 4,5 at a time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As the order matters here !!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2016 18:09:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285312#M58296</guid>
      <dc:creator>sdixit</dc:creator>
      <dc:date>2016-07-18T18:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: Combination and permutation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285321#M58300</link>
      <description>&lt;P&gt;If order matters then you are looking at permutations, not combinations.&lt;/P&gt;
&lt;P&gt;You say order matters, but what order?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you looked at the ALLPERM function?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2016 18:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285321#M58300</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-07-18T18:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Combination and permutation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285325#M58302</link>
      <description>&lt;P&gt;I need to create string combined 2 out of 5 number (8,9-,9,9+,10).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then 3 , then 4 , and then 5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then need to create all possible permutaion of that combinations&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like example :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Conside (&amp;nbsp;8 , 9 ) ( 8, 9+) &amp;nbsp;, (8, 9-)&lt;/P&gt;&lt;P&gt;permutaion of above is reverse order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like Need to create another combination of 3 number among 5 and create all permuation of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, I tried ALLPERM and ALL COMB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but didnot work out.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2016 18:27:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285325#M58302</guid>
      <dc:creator>sdixit</dc:creator>
      <dc:date>2016-07-18T18:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Combination and permutation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285357#M58321</link>
      <description>&lt;P&gt;Please post what you've tried. How many numbers in your list?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2016 20:02:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285357#M58321</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-18T20:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Combination and permutation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285363#M58324</link>
      <description>&lt;P&gt;Please show what you tried and exactly why it "did not work out". You may have been close. For instance when generating a data set you likely did not include an output statement in the correct place. Also you would need to create target variables to hold the results as desired.&lt;/P&gt;
&lt;P&gt;And since you are looking to apparantly do permutation after combinations then you will likely need to go through a couple of datasteps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And for curiosity's sake, what will you be doing with the resulting data set? Sometimes there are other approaches to the same end that are either more direct or less cumbersome.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also,&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2016 20:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285363#M58324</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-07-18T20:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Combination and permutation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285872#M58533</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sure! My motive is to create a flag when my variable matches with any number from ('8', '9+',' 9', '9-', '10')&amp;nbsp;&amp;nbsp;string.&lt;/P&gt;&lt;P&gt;So if there is any number present in my variable ABC , it should set the flag = "Y".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data looks like :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;ABC&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Flag&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;5,7,8&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;9,7,4&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;8&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;9&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;9+&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;9-&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;10&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;Y&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;5,6&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;N&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;3,2&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Arial" size="2"&gt;N&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 20 Jul 2016 16:51:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285872#M58533</guid>
      <dc:creator>sdixit</dc:creator>
      <dc:date>2016-07-20T16:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Combination and permutation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285877#M58535</link>
      <description>&lt;P&gt;Generating all combinations/permutations would be a massive overkill. Does it have to contain&amp;nbsp;all or any?&lt;/P&gt;
&lt;P&gt;1. Create a temporary&amp;nbsp;array with your set of lookup values&lt;/P&gt;
&lt;P&gt;2. Use SCAN() to separate out components in ABC&lt;/P&gt;
&lt;P&gt;3. Use WHICHC to find if the value is present.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input ABC $10.;
	cards;
5,7,8
9,7,4
8
9
9+
9-
10
5,6
3,2
;

data want;
	set have;
	array lookup(5)  $10 _temporary_ ('8' '9+' '9' '9-' '10');
	n=countw(abc);
	flag='N';

	do i=1 to n;
		part=strip(scan(abc, i, ","));

		if whichc(part, of lookup(*))&amp;gt;0 then
			flag='Y';
	end;
	
	keep abc flag ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 17:05:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285877#M58535</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-20T17:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Combination and permutation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285881#M58537</link>
      <description>&lt;P&gt;it is any number then flag ="y" . Varibale can have&amp;nbsp;single digit or string of digits.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 17:08:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285881#M58537</guid>
      <dc:creator>sdixit</dc:creator>
      <dc:date>2016-07-20T17:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Combination and permutation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285887#M58541</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/90536"&gt;@sdixit&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;it is any number then flag ="y" . Varibale can have&amp;nbsp;single digit or string of digits.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then solution above should work, given your stated requirements.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 17:11:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combination-and-permutation/m-p/285887#M58541</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-20T17:11:05Z</dc:date>
    </item>
  </channel>
</rss>

