<?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: How to count in multiple columns with Proc Freq in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-count-in-multiple-columns-with-Proc-Freq/m-p/206950#M15515</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, and you can even do it in the tasks in Enterprise Guide, without writing code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Use the Transpose Data task to turn your "instruction" columns into a single row. Put ID into the "group analysis by" role (you'll need to have sorted by ID if they're not in that sequence), and the "instruction" columns into the "Transpose variables" role. You'll see the result will be a three-column table with your ID, the name of the column that contributed the value, and the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. As an optional step, if you only want to analyse particular "instruction" columns, run a query to exclude the rows that you don't want. (Alternatively, you could get rid of the columns prior to the transpose).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. You should be able to use several of the "Describe" tools to obtain frequency counts on the data values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Jun 2015 12:22:40 GMT</pubDate>
    <dc:creator>TomKari</dc:creator>
    <dc:date>2015-06-16T12:22:40Z</dc:date>
    <item>
      <title>How to count in multiple columns with Proc Freq</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-count-in-multiple-columns-with-Proc-Freq/m-p/206949#M15514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I am using SAS EG 5.1 at work. I have a data base like below, with 14 columns. 1st column is unique IDs , and the rest are Instructions, which are in form of codes (numbers between 0 - 200) . Is there a way I can calculate the frequency of occurrence of a specific code value (for eg 30) in the whole instruction 1 : instruction 13 grid collectively. I have tried Proc freq, but that gives me tables for single columns separately. &lt;/P&gt;&lt;P&gt;I have previously done this in excel using the countif (range, criteria) code where I have set the range to the whole grid, and criteria as the value of the specific code.&lt;/P&gt;&lt;P&gt;Is there a SAS EG/BASE equivalent to the above function , where I can find the collective frequency of a specific number in a range of columns. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="border: 1px solid rgb(0, 0, 0); width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;ID&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;instruction 1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;instruction2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;instruction 3&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;instruction 4&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;instruction 1&lt;/STRONG&gt;0&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;TABLE border="1" class="jiveBorder" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;instruction 11&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;TABLE border="1" class="jiveBorder" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;instruction 12&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;TABLE border="1" class="jiveBorder" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="border: 1px solid #000000; width: 100%;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG style="color: #ffffff; font-size: 13.3333330154419px; text-align: center;"&gt;instruction 13&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the help &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 02:17:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-count-in-multiple-columns-with-Proc-Freq/m-p/206949#M15514</guid>
      <dc:creator>muchkin</dc:creator>
      <dc:date>2015-06-16T02:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to count in multiple columns with Proc Freq</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-count-in-multiple-columns-with-Proc-Freq/m-p/206950#M15515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, and you can even do it in the tasks in Enterprise Guide, without writing code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Use the Transpose Data task to turn your "instruction" columns into a single row. Put ID into the "group analysis by" role (you'll need to have sorted by ID if they're not in that sequence), and the "instruction" columns into the "Transpose variables" role. You'll see the result will be a three-column table with your ID, the name of the column that contributed the value, and the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. As an optional step, if you only want to analyse particular "instruction" columns, run a query to exclude the rows that you don't want. (Alternatively, you could get rid of the columns prior to the transpose).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. You should be able to use several of the "Describe" tools to obtain frequency counts on the data values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 12:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-count-in-multiple-columns-with-Proc-Freq/m-p/206950#M15515</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2015-06-16T12:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to count in multiple columns with Proc Freq</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-count-in-multiple-columns-with-Proc-Freq/m-p/206951#M15516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here you go, I shortened my answer but I think you'll get the idea:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input id instruction1 instruction2 instruction3 instruction4 instruction5 instruction6;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 1 0 0 0 0 0&lt;/P&gt;&lt;P&gt;2 0 0 0 0 0 0&lt;/P&gt;&lt;P&gt;3 1 1 1 1 1 1&lt;/P&gt;&lt;P&gt;4 0 0 1 0 1 0&lt;/P&gt;&lt;P&gt;5 1 0 1 0 1 0&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=have out=prep;by id;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as&lt;/P&gt;&lt;P&gt;select count(col1) as result&lt;/P&gt;&lt;P&gt;from prep&lt;/P&gt;&lt;P&gt;where col1 = 1;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2015 12:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-count-in-multiple-columns-with-Proc-Freq/m-p/206951#M15516</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-06-16T12:30:05Z</dc:date>
    </item>
  </channel>
</rss>

