<?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 unable to get the cumulative value in the datastep in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/unable-to-get-the-cumulative-value-in-the-datastep/m-p/122395#M25106</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data text;&lt;/P&gt;&lt;P&gt;set data1;&lt;/P&gt;&lt;P&gt;if nobs=1 then do;&lt;/P&gt;&lt;P&gt;b=0;&lt;/P&gt;&lt;P&gt;v=0;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;b=b+bal;&lt;/P&gt;&lt;P&gt;v=v+val;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where my data1 datset contains a column nobs like below&lt;/P&gt;&lt;P&gt;nobs &lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;7&lt;/P&gt;&lt;P&gt;and i want result like&lt;/P&gt;&lt;P&gt; nobs bal val&lt;/P&gt;&lt;P&gt; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;/P&gt;&lt;P&gt;likewise&lt;/P&gt;&lt;P&gt;the code should produce the cumulative values ,but i am getting the missing value when i run the above code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can anyone let me know is there any other way to do or y is this failing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Jan 2013 05:54:28 GMT</pubDate>
    <dc:creator>shru</dc:creator>
    <dc:date>2013-01-11T05:54:28Z</dc:date>
    <item>
      <title>unable to get the cumulative value in the datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unable-to-get-the-cumulative-value-in-the-datastep/m-p/122395#M25106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data text;&lt;/P&gt;&lt;P&gt;set data1;&lt;/P&gt;&lt;P&gt;if nobs=1 then do;&lt;/P&gt;&lt;P&gt;b=0;&lt;/P&gt;&lt;P&gt;v=0;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;b=b+bal;&lt;/P&gt;&lt;P&gt;v=v+val;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where my data1 datset contains a column nobs like below&lt;/P&gt;&lt;P&gt;nobs &lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;6&lt;/P&gt;&lt;P&gt;7&lt;/P&gt;&lt;P&gt;and i want result like&lt;/P&gt;&lt;P&gt; nobs bal val&lt;/P&gt;&lt;P&gt; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;/P&gt;&lt;P&gt;likewise&lt;/P&gt;&lt;P&gt;the code should produce the cumulative values ,but i am getting the missing value when i run the above code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can anyone let me know is there any other way to do or y is this failing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2013 05:54:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unable-to-get-the-cumulative-value-in-the-datastep/m-p/122395#M25106</guid>
      <dc:creator>shru</dc:creator>
      <dc:date>2013-01-11T05:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: unable to get the cumulative value in the datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unable-to-get-the-cumulative-value-in-the-datastep/m-p/122396#M25107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't understand the result that you are trying to get, but there are several obvious problems that will yield missing data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) you need to read about the RETAIN statement for DATA step accumulation.&lt;/P&gt;&lt;P&gt;2) nobs never takes on the value '1' so the first DO is never executed.&lt;/P&gt;&lt;P&gt;3) bal and val are not in the input data set, so they start as missings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc Muhlbaier&lt;/P&gt;&lt;P&gt;Duke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2013 14:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unable-to-get-the-cumulative-value-in-the-datastep/m-p/122396#M25107</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2013-01-11T14:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: unable to get the cumulative value in the datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unable-to-get-the-cumulative-value-in-the-datastep/m-p/122397#M25108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data text;&lt;/P&gt;&lt;P&gt;set data1;&lt;/P&gt;&lt;P&gt;b+bal;&lt;/P&gt;&lt;P&gt;v+val;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2013 14:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unable-to-get-the-cumulative-value-in-the-datastep/m-p/122397#M25108</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2013-01-11T14:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: unable to get the cumulative value in the datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unable-to-get-the-cumulative-value-in-the-datastep/m-p/122398#M25109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try changing&lt;/P&gt;&lt;P&gt;b=b+bal;&lt;/P&gt;&lt;P&gt;v=v+val;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;b+bal;&lt;/P&gt;&lt;P&gt;v+val;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2013 14:44:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unable-to-get-the-cumulative-value-in-the-datastep/m-p/122398#M25109</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-01-11T14:44:01Z</dc:date>
    </item>
  </channel>
</rss>

