<?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: Counting total in horizontal row in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631732#M20979</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/316342"&gt;@Mil00&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to calculate total percent of each student horizontally (green arrow) using proc freq procedure, but the result I am getting is calculated vertically (orange arrow). Any help will be appreciated.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1example.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36820i63C3B811E59D4F23/image-size/large?v=v2&amp;amp;px=999" role="button" title="1example.PNG" alt="1example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you need the Percent of values that are 1 on each row then the MEAN function is what you want:&lt;/P&gt;
&lt;P&gt;You don't show valid SAS variable names for the week variables but&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   percent = mean(of week:);
run;&lt;/PRE&gt;
&lt;P&gt;or explicitly list the variables of interest.&lt;/P&gt;
&lt;P&gt;The mean will be between 0 and 1, so 0.5 = 50%. If you want to display percentage values then use a format like Percent8.2 , or do the multiply by 100 to shift the decimal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Counting would be something different&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;n (of week: ) would give the number of variables that have a value. But you did not describe what you might actually be counting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Mar 2020 22:56:25 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-03-12T22:56:25Z</dc:date>
    <item>
      <title>Counting total in horizontal row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631701#M20967</link>
      <description>&lt;P&gt;I am trying to calculate total percent of each student horizontally (green arrow) using proc freq procedure, but the result I am getting is calculated vertically (orange arrow). Any help will be appreciated.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1example.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36820i63C3B811E59D4F23/image-size/large?v=v2&amp;amp;px=999" role="button" title="1example.PNG" alt="1example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 20:19:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631701#M20967</guid>
      <dc:creator>Mil00</dc:creator>
      <dc:date>2020-03-12T20:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Counting total in horizontal row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631702#M20968</link>
      <description>&lt;P&gt;Is it a requirement to use PROC FREQ?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 20:22:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631702#M20968</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-03-12T20:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Counting total in horizontal row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631704#M20970</link>
      <description>&lt;P&gt;PROC FREQ, by itself will not produce the count you want. You can do this in either a DATA step, or PROC TRANSPOSE followed by PROC FREQ, or possibly other methods.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 20:33:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631704#M20970</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-12T20:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Counting total in horizontal row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631705#M20971</link>
      <description>&lt;P&gt;No, it's not. I just need to count them horizontally&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 20:36:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631705#M20971</guid>
      <dc:creator>Mil00</dc:creator>
      <dc:date>2020-03-12T20:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: Counting total in horizontal row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631706#M20972</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    count = sum(of weekno1-weekno12);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Mar 2020 20:39:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631706#M20972</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-12T20:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Counting total in horizontal row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631732#M20979</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/316342"&gt;@Mil00&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am trying to calculate total percent of each student horizontally (green arrow) using proc freq procedure, but the result I am getting is calculated vertically (orange arrow). Any help will be appreciated.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1example.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36820i63C3B811E59D4F23/image-size/large?v=v2&amp;amp;px=999" role="button" title="1example.PNG" alt="1example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you need the Percent of values that are 1 on each row then the MEAN function is what you want:&lt;/P&gt;
&lt;P&gt;You don't show valid SAS variable names for the week variables but&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   percent = mean(of week:);
run;&lt;/PRE&gt;
&lt;P&gt;or explicitly list the variables of interest.&lt;/P&gt;
&lt;P&gt;The mean will be between 0 and 1, so 0.5 = 50%. If you want to display percentage values then use a format like Percent8.2 , or do the multiply by 100 to shift the decimal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Counting would be something different&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;n (of week: ) would give the number of variables that have a value. But you did not describe what you might actually be counting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2020 22:56:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Counting-total-in-horizontal-row/m-p/631732#M20979</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-12T22:56:25Z</dc:date>
    </item>
  </channel>
</rss>

