<?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 Proc Freq table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470637#M120447</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've a dataset with 10 variables and each takes only 0 or 1 (No/Yes). I want to compare the freq of 'yes' among variables to a&amp;nbsp;specific variables called VLU (also yes/no), shown in the picture.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 243px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21212i4C8033182207502C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jun 2018 16:01:37 GMT</pubDate>
    <dc:creator>Sujithpeta</dc:creator>
    <dc:date>2018-06-15T16:01:37Z</dc:date>
    <item>
      <title>Proc Freq table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470637#M120447</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've a dataset with 10 variables and each takes only 0 or 1 (No/Yes). I want to compare the freq of 'yes' among variables to a&amp;nbsp;specific variables called VLU (also yes/no), shown in the picture.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 243px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21212i4C8033182207502C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 16:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470637#M120447</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-06-15T16:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470646#M120448</link>
      <description>&lt;P&gt;A couple of suggestions ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, it's easier to use PROC TABULATE to get these results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, I imagine you don't need the frequency of YES for VARIABLE1 through VARIABLE9. Rather, you could use the average value.&amp;nbsp; A side benefit would be that you can condense the table into one row for each of the 9 variables.&amp;nbsp; So, consider this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc tabulate data=have;&lt;/P&gt;
&lt;P&gt;class VLU;&lt;/P&gt;
&lt;P&gt;var variable1-variable9;&lt;/P&gt;
&lt;P&gt;tables VLU * mean=' ', variable1-variable9;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are lots of ways to improve the table appearance, but see if this gets you started in the right direction.&amp;nbsp; You also might need to add a format for VLU, using a format that prints 1 as "Yes" and 0 as "No".&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 16:24:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470646#M120448</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-15T16:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470648#M120449</link>
      <description>&lt;P&gt;One way to get started:&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=have;
   class vlu;
   var variable1-variable9;
   table variable1-variable*sum='',
         vlu
   ;
run;&lt;/PRE&gt;
&lt;P&gt;options affecting appearance such as a format for VLU to display Yes/NO instead of 1/0 and such to make this prettier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Labels for variables also.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc freq doesn't let you combine that many variables into a single result, Procs Tabulate and Report would.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 16:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470648#M120449</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-15T16:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470653#M120451</link>
      <description>&lt;P&gt;How should I change the code if each variable has different name and not in a sequence to write as Variable1-Variable?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 16:56:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470653#M120451</guid>
      <dc:creator>Sujithpeta</dc:creator>
      <dc:date>2018-06-15T16:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470657#M120452</link>
      <description>&lt;P&gt;You can replace variable1-variable9 with a list:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;variable1 variable2 variable3 ..... variable9&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on where it appears&amp;nbsp; in PROC TABULATE, you may need to enclose the list in parentheses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I think the best table structure would be a combination of what I posted and what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;posted:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;tables variable1-variable9, VLU * mean=' ';&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can experiment with using SUM= or MEAN=, to see which you prefer.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 17:19:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470657#M120452</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-15T17:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Freq table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470681#M120456</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;You can replace variable1-variable9 with a list:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;variable1 variable2 variable3 ..... variable9&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on where it appears&amp;nbsp; in PROC TABULATE, you may need to enclose the list in parentheses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I think the best table structure would be a combination of what I posted and what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;posted:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;tables variable1-variable9, VLU * mean=' ';&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can experiment with using SUM= or MEAN=, to see which you prefer.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The mean of a 0/1 coded response as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;suggests will give the percentage of 1's. In which case you might want to us&lt;/P&gt;
&lt;P&gt;mean*f=percent8.2&amp;nbsp;or similar. The *f= says to use the format following the = as the format for the resulting statistic.&lt;/P&gt;
&lt;P&gt;The sum I suggested give the count of 1's. So use of sum*f=6. would suppress the default decimal portion and assume 6 characters as the longest result.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 19:15:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Freq-table/m-p/470681#M120456</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-15T19:15:20Z</dc:date>
    </item>
  </channel>
</rss>

