<?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 How to get the frequency of combinations of values in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-the-frequency-of-combinations-of-values/m-p/930379#M41834</link>
    <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppose to have the following table:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DB;
input ID :$20. Resp1 :$20. Resp2 :$20. Resp3 :$20.;
cards;
1 a b .
2 a c .
3 d . .
4 a b f
5 a b .
....
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there a way to get the number of all combinations?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired output:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="64" height="19" class="xl63" style="height: 14.5pt; width: 48pt;"&gt;Combination&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;Freq&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.5pt;"&gt;ab&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.5pt;"&gt;ac&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.5pt;"&gt;d&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.5pt;"&gt;abf&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.5pt;"&gt;......&lt;/TD&gt;
&lt;TD class="xl63"&gt;...&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
    <pubDate>Fri, 31 May 2024 07:59:03 GMT</pubDate>
    <dc:creator>NewUsrStat</dc:creator>
    <dc:date>2024-05-31T07:59:03Z</dc:date>
    <item>
      <title>How to get the frequency of combinations of values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-the-frequency-of-combinations-of-values/m-p/930379#M41834</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppose to have the following table:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DB;
input ID :$20. Resp1 :$20. Resp2 :$20. Resp3 :$20.;
cards;
1 a b .
2 a c .
3 d . .
4 a b f
5 a b .
....
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there a way to get the number of all combinations?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired output:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="64" height="19" class="xl63" style="height: 14.5pt; width: 48pt;"&gt;Combination&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="width: 48pt;"&gt;Freq&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.5pt;"&gt;ab&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.5pt;"&gt;ac&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.5pt;"&gt;d&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.5pt;"&gt;abf&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl63" style="height: 14.5pt;"&gt;......&lt;/TD&gt;
&lt;TD class="xl63"&gt;...&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 07:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-the-frequency-of-combinations-of-values/m-p/930379#M41834</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-05-31T07:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the frequency of combinations of values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-the-frequency-of-combinations-of-values/m-p/930381#M41835</link>
      <description>The easy way to count observations in a SAS data set is PROC FREQ:&lt;BR /&gt;&lt;BR /&gt;proc freq data=DB;&lt;BR /&gt;tables resp1 * resp2 * resp3 /&lt;BR /&gt;       list missing;&lt;BR /&gt;run;</description>
      <pubDate>Fri, 31 May 2024 08:45:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-the-frequency-of-combinations-of-values/m-p/930381#M41835</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2024-05-31T08:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the frequency of combinations of values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-the-frequency-of-combinations-of-values/m-p/930389#M41838</link>
      <description>&lt;P&gt;I love this kind of question.&lt;/P&gt;
&lt;P&gt;EDITED&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DB;
input ID :$20. Resp1 :$20. Resp2 :$20. Resp3 :$20.;
cards;
1 a b .
2 a c .
3 d . .
4 a b f
5 a b .
;
data temp;
 set db;
 array r{3} $ Resp1-Resp3;
 call sortc(of r{*});
 do n=1 to dim(r);
   if missing(r{n}) then r{n}='09'x;
 end;

 array x{3};
 length combination $ 80;
 k=-1;
 do i=1 to 2**dim(x);
   rc=graycode(k,of x{*});
   call missing(combination);
   do j=1 to dim(x);
    if x{j}=1 then combination=cats(combination,r{j});
   end;
   if not findc(combination,'09'x) and not missing(combination) then output; 
 end;
 keep combination;
run;
proc freq data=temp noprint;
table combination/out=want ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 May 2024 09:40:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-the-frequency-of-combinations-of-values/m-p/930389#M41838</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-05-31T09:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the frequency of combinations of values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-the-frequency-of-combinations-of-values/m-p/930427#M41839</link>
      <description>&lt;P&gt;A question that might become of interest would be&amp;nbsp; is there a difference in the "combination"&lt;/P&gt;
&lt;PRE&gt;1 a b .
2 a . b&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 May 2024 13:31:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-the-frequency-of-combinations-of-values/m-p/930427#M41839</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-05-31T13:31:05Z</dc:date>
    </item>
  </channel>
</rss>

