<?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 Sum Statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sum-Statement/m-p/252444#M47908</link>
    <description>&lt;P&gt;&amp;nbsp;----|----10---|----20---|----30&lt;/P&gt;&lt;P&gt;1901 2&lt;/P&gt;&lt;P&gt;1905 1&lt;/P&gt;&lt;P&gt;1910 6&lt;BR /&gt;1925 .&lt;BR /&gt;1941 1&lt;BR /&gt;The following SAS program is submitted and references the raw data file above:&lt;BR /&gt;data coins;&lt;BR /&gt;infile'file-specification';&lt;BR /&gt;input year quantity;&lt;BR /&gt;&amp;lt;insert statement(s) here&amp;gt;&lt;BR /&gt;run;&lt;BR /&gt;Which one of the following completes the program and produces a non-missing&lt;BR /&gt;value for the variable TOTQUANTITY in the last observation of the output data&lt;BR /&gt;set? &amp;nbsp;(here quantity is the numbers 2,1,6,.,1 in the dataset)&lt;BR /&gt;&lt;BR /&gt;A. totquantity + quantity;&lt;BR /&gt;B. totquantity = sum(totquantity + quantity);&lt;BR /&gt;C. totquantity 0;&lt;BR /&gt;sum totquantity;&lt;BR /&gt;D. retain totquantity 0;&lt;BR /&gt;totquantity = totquantity = quantity;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ans –A&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Doubt: As A is not in a SUM or RETAIN statement won't it cause missing value as '.'; or does this expression accumulates and retains the values?&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Feb 2016 17:37:35 GMT</pubDate>
    <dc:creator>Bulleride</dc:creator>
    <dc:date>2016-02-25T17:37:35Z</dc:date>
    <item>
      <title>Sum Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-Statement/m-p/252444#M47908</link>
      <description>&lt;P&gt;&amp;nbsp;----|----10---|----20---|----30&lt;/P&gt;&lt;P&gt;1901 2&lt;/P&gt;&lt;P&gt;1905 1&lt;/P&gt;&lt;P&gt;1910 6&lt;BR /&gt;1925 .&lt;BR /&gt;1941 1&lt;BR /&gt;The following SAS program is submitted and references the raw data file above:&lt;BR /&gt;data coins;&lt;BR /&gt;infile'file-specification';&lt;BR /&gt;input year quantity;&lt;BR /&gt;&amp;lt;insert statement(s) here&amp;gt;&lt;BR /&gt;run;&lt;BR /&gt;Which one of the following completes the program and produces a non-missing&lt;BR /&gt;value for the variable TOTQUANTITY in the last observation of the output data&lt;BR /&gt;set? &amp;nbsp;(here quantity is the numbers 2,1,6,.,1 in the dataset)&lt;BR /&gt;&lt;BR /&gt;A. totquantity + quantity;&lt;BR /&gt;B. totquantity = sum(totquantity + quantity);&lt;BR /&gt;C. totquantity 0;&lt;BR /&gt;sum totquantity;&lt;BR /&gt;D. retain totquantity 0;&lt;BR /&gt;totquantity = totquantity = quantity;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ans –A&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Doubt: As A is not in a SUM or RETAIN statement won't it cause missing value as '.'; or does this expression accumulates and retains the values?&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 17:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-Statement/m-p/252444#M47908</guid>
      <dc:creator>Bulleride</dc:creator>
      <dc:date>2016-02-25T17:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sum Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-Statement/m-p/252457#M47917</link>
      <description>&lt;P&gt;This is called &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000289454.htm" target="_self"&gt;Sum Statment&lt;/A&gt;&amp;nbsp;in SAS. And it&amp;nbsp;&lt;SPAN&gt;is equivalent to using the SUM function and the RETAIN statement.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;As you noticed in your data you have missing values so to do the cumulative summation you need the SUM function and Retain or as shortcut you can use the SUM statment.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 18:09:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-Statement/m-p/252457#M47917</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2016-02-25T18:09:05Z</dc:date>
    </item>
  </channel>
</rss>

