<?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: Count and Sum Function in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Count-and-Sum-Function/m-p/90636#M25888</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps even:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;points_possible = n(of S:);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Dec 2012 23:41:57 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2012-12-04T23:41:57Z</dc:date>
    <item>
      <title>Count and Sum Function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Count-and-Sum-Function/m-p/90633#M25885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all—&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I’m trying to use base SAS to count points possible and points earned. When counting points possible missing values do not count. I have been trying to use the count function. Is that correct? Your help is appreciated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (keep=S1 S2 S3 S4 S5); &lt;/P&gt;&lt;P&gt;set have; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Points_ Possible&lt;/STRONG&gt;=count(S1, S2, S3, S4 ,S5); Not&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Total_ points=&lt;/STRONG&gt;sum&lt;STRONG&gt;(&lt;/STRONG&gt;S1, S2, S3, S4 ,S5&lt;STRONG&gt;);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 433px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl22" height="17" width="64"&gt;I&lt;STRONG&gt;d_Survey&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl23" style="border-left: none;" width="32"&gt;&lt;STRONG&gt;S1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl23" style="border-left: none;" width="32"&gt;&lt;STRONG&gt;S2&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl23" style="border-left: none;" width="25"&gt;&lt;STRONG&gt;S3&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl23" style="border-left: none;" width="25"&gt;&lt;STRONG&gt;S4&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl23" style="border-left: none;" width="25"&gt;&lt;STRONG&gt;S5&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl23" style="border-left: none;" width="109"&gt;&lt;STRONG&gt;Points_ Possible&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl23" style="border-left: none;" width="121"&gt;&lt;STRONG&gt;Total_ points&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl22" height="17" style="border-top: none;"&gt;4545&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;1.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;0.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;1.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;1.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;0.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;5.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;3.0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl22" height="17" style="border-top: none;"&gt;999&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;0.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;1.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;1.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;3.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;2.0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl22" height="17" style="border-top: none;"&gt;784&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;0.5&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;0.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;1.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;0.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;4.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;1.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl22" height="17" style="border-top: none;"&gt;852&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;0.5&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;1.0&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;&lt;TD class="xl24" style="border-top: none; border-left: none;"&gt;2.0&lt;/TD&gt;&lt;TD class="xl23" style="border-top: none; border-left: none;"&gt;1.5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!!! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2012 22:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Count-and-Sum-Function/m-p/90633#M25885</guid>
      <dc:creator>Mgarret</dc:creator>
      <dc:date>2012-12-04T22:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Sum Function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Count-and-Sum-Function/m-p/90634#M25886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the n() function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (keep=S1 S2 S3 S4 S5 Points_possible total_points); &lt;/P&gt;&lt;P&gt;set have; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Points_ Possible&lt;/STRONG&gt;=n(S1, S2, S3, S4 ,S5); &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Total_ points=&lt;/STRONG&gt;sum&lt;STRONG&gt;(&lt;/STRONG&gt;S1, S2, S3, S4 ,S5&lt;STRONG&gt;);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2012 23:27:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Count-and-Sum-Function/m-p/90634#M25886</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-12-04T23:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Sum Function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Count-and-Sum-Function/m-p/90635#M25887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are a number of ways to do what you want.&amp;nbsp; I prefer something like the following, as it is easy to modify for different surveys:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input Id_Survey S1 S2 S3 S4 S5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;4545 1.0 0.0 1.0 1.0 0.0 5.0 3.0&lt;/P&gt;&lt;P&gt;999 0.0 1.0 . . 1.0 3.0 2.0&lt;/P&gt;&lt;P&gt;784 . 0.5 0.0 1.0 0.0 4.0 1.5&lt;/P&gt;&lt;P&gt;852 0.5 . 1.0 . . 2.0 1.5&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array s(*) s:;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Points_Possible=dim(s)-nmiss(of S:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; Total_points=sum(of S:);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2012 23:27:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Count-and-Sum-Function/m-p/90635#M25887</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-12-04T23:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count and Sum Function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Count-and-Sum-Function/m-p/90636#M25888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps even:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;points_possible = n(of S:);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2012 23:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Count-and-Sum-Function/m-p/90636#M25888</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-12-04T23:41:57Z</dc:date>
    </item>
  </channel>
</rss>

