<?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: PROC FREQ, but for multiple variables with the same values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-but-for-multiple-variables-with-the-same-values/m-p/737925#M230098</link>
    <description>&lt;P&gt;Worked perfectly, thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 29 Apr 2021 14:17:01 GMT</pubDate>
    <dc:creator>DAppelbaum83</dc:creator>
    <dc:date>2021-04-29T14:17:01Z</dc:date>
    <item>
      <title>PROC FREQ, but for multiple variables with the same values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-but-for-multiple-variables-with-the-same-values/m-p/737806#M230046</link>
      <description>&lt;P&gt;I am trying to write a very simple procedure that just counts the distinct values of a given number of fields across a few variables, and tabluates them. PROC FREQ does it for one, but I'm trying to do more than one at once and have them all in a table - haven't had any luck with PROC TABLUATE as it seems to be not for this particular purpose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance, given the below dataset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080"&gt;data&lt;/FONT&gt; &lt;/STRONG&gt;a;&lt;/P&gt;&lt;P&gt;input (A1 A2 A3) &lt;FONT color="#666699"&gt;($)&lt;/FONT&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080"&gt;datalines; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;A&amp;nbsp; B&amp;nbsp; D&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;B&amp;nbsp; B&amp;nbsp; D&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;D&amp;nbsp; A&amp;nbsp; E&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would expect some output table like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A1&amp;nbsp; &amp;nbsp; A2&amp;nbsp; &amp;nbsp; A3&lt;/U&gt;&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;D&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;E&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do that with PROC FREQ or PROC TABLUATE?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 05:03:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-but-for-multiple-variables-with-the-same-values/m-p/737806#M230046</guid>
      <dc:creator>DAppelbaum83</dc:creator>
      <dc:date>2021-04-29T05:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FREQ, but for multiple variables with the same values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-but-for-multiple-variables-with-the-same-values/m-p/737809#M230048</link>
      <description>&lt;P&gt;You need to transpose the data first, afterwards proc tabulate can create the expected output:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data transposed;
   set a;
   array _a[3] a1--a3;
   
   length a $ 2 value $ 1;
   
   do i = 1 to dim(_a);
      a = vname(_a[i]);
      value = _a[i];
      output;
   end;
   
   drop a1--a3 i;
run;

option missing='0';

proc tabulate data=transposed;
   class a value;
   
   table value= ' ', a= ' ';
   keylabel n = ' ';
run;

options missing='.';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Apr 2021 05:42:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-but-for-multiple-variables-with-the-same-values/m-p/737809#M230048</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-04-29T05:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FREQ, but for multiple variables with the same values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-but-for-multiple-variables-with-the-same-values/m-p/737925#M230098</link>
      <description>&lt;P&gt;Worked perfectly, thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 14:17:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-but-for-multiple-variables-with-the-same-values/m-p/737925#M230098</guid>
      <dc:creator>DAppelbaum83</dc:creator>
      <dc:date>2021-04-29T14:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FREQ, but for multiple variables with the same values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-but-for-multiple-variables-with-the-same-values/m-p/738001#M230134</link>
      <description>Quick follow up, would you know how to display the % of total in addition to the count?</description>
      <pubDate>Thu, 29 Apr 2021 19:51:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-FREQ-but-for-multiple-variables-with-the-same-values/m-p/738001#M230134</guid>
      <dc:creator>DAppelbaum83</dc:creator>
      <dc:date>2021-04-29T19:51:34Z</dc:date>
    </item>
  </channel>
</rss>

