<?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: Subtraction of the data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/572656#M161624</link>
    <description>&lt;P&gt;Please post example data in usable form, like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input yr mth pd cumulative os;
datalines;
2004 12 24 24 10
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For your solution, you only need to insert the formula you stated:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
total = cumulative + os - 10;
keep yr mth total;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Why does the first observation in your expected output have a minus sign as total? According to your formula, that should be 24.&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jul 2019 10:51:34 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-07-11T10:51:34Z</dc:date>
    <item>
      <title>Subtraction of the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/572654#M161622</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using SAS for the very first time and it would be much appreciated if any of you could help me a favour.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I have the data A as shown below here :&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="1.PNG" style="width: 299px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30941i5FA3F2FA8ECC33E3/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.PNG" alt="1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I would like to get the final result (TOTAL column) as shown below, where TOTAL = cumulative + OS - 10 , e.g -7 = 2+1-10 and -2 = 6+2-10 . So I would like to know is there a way to compute the final result like below using SAS?&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="2.PNG" style="width: 181px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30942i96DD4B9CB544D532/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2.PNG" alt="2.PNG" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 10:35:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/572654#M161622</guid>
      <dc:creator>tyw2304</dc:creator>
      <dc:date>2019-07-11T10:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: Subtraction of the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/572656#M161624</link>
      <description>&lt;P&gt;Please post example data in usable form, like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input yr mth pd cumulative os;
datalines;
2004 12 24 24 10
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For your solution, you only need to insert the formula you stated:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
total = cumulative + os - 10;
keep yr mth total;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Why does the first observation in your expected output have a minus sign as total? According to your formula, that should be 24.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 10:51:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/572656#M161624</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-11T10:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Subtraction of the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/572835#M161676</link>
      <description>&lt;P&gt;Yes it's a negative value and I want it to be -10 at the back of the equation&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 16:43:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/572835#M161676</guid>
      <dc:creator>tyw2304</dc:creator>
      <dc:date>2019-07-11T16:43:36Z</dc:date>
    </item>
    <item>
      <title>Re: Subtraction of the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/572863#M161683</link>
      <description>&lt;P&gt;In your first observation, cumulative is 24 and OS is 10. 24 + 10 - 10 gives 24, and not just a minus sign (which is impossible with SAS numbers, anyway).&lt;/P&gt;
&lt;P&gt;Please clarify.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 17:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/572863#M161683</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-11T17:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Subtraction of the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/572875#M161686</link>
      <description>&lt;P&gt;The cumulative 24 is a baseline for Dec 2014, therefore we don't consider 24 as we don't have any data from Dec 2013 for comparison, so only consider the following months of 2015, where the TOTAL column is calculated with respective to Dec 2014.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 17:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/572875#M161686</guid>
      <dc:creator>tyw2304</dc:creator>
      <dc:date>2019-07-11T17:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Subtraction of the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/573796#M162048</link>
      <description>&lt;P&gt;So when do you start your calculation? Is it the first January (for a given group, if such can be determined)?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 10:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Subtraction-of-the-data/m-p/573796#M162048</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-16T10:53:36Z</dc:date>
    </item>
  </channel>
</rss>

