<?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: Adding Difference to Individual Observation of a data set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107483#M22392</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"Add" to what? Do you need a new variable? Please post the dataset you want to create.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Jul 2012 07:47:34 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2012-07-16T07:47:34Z</dc:date>
    <item>
      <title>Adding Difference to Individual Observation of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107482#M22391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DATA Deposits;&lt;/P&gt;&lt;P&gt;input Acctno type $ Balance;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 Demand 10&lt;/P&gt;&lt;P&gt;2 Time 20&lt;/P&gt;&lt;P&gt;3 Demand 10&lt;/P&gt;&lt;P&gt;4 Saving 30&lt;/P&gt;&lt;P&gt;5 Demand 10&lt;/P&gt;&lt;P&gt;6 Saving 30&lt;/P&gt;&lt;P&gt;7 Time 20&lt;/P&gt;&lt;P&gt;8 Saving 30&lt;/P&gt;&lt;P&gt;9 Demand 10&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let Diff_DD = 1;&lt;/P&gt;&lt;P&gt;%let Diff_SD = 2;&lt;/P&gt;&lt;P&gt;%let Diff_TD = 3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need o add&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Diff_DD value to the "1 Demand 10" &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Diff_TD value to the "2&amp;nbsp; Time 20"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Diff_SD value to the "4 Saving 30"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Jul 2012 02:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107482#M22391</guid>
      <dc:creator>OniMoni</dc:creator>
      <dc:date>2012-07-15T02:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Difference to Individual Observation of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107483#M22392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"Add" to what? Do you need a new variable? Please post the dataset you want to create.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jul 2012 07:47:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107483#M22392</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2012-07-16T07:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Difference to Individual Observation of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107484#M22393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you want to concatenate the macro variable value to concatenation of other 3 variables ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2012 13:23:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107484#M22393</guid>
      <dc:creator>rajat_sas</dc:creator>
      <dc:date>2012-07-20T13:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Difference to Individual Observation of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107485#M22394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Declare the macro variables first, then add the difference variable in the same DATA step:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let Diff_DD = 1;&lt;/P&gt;&lt;P&gt;%let Diff_SD = 2;&lt;/P&gt;&lt;P&gt;%let Diff_TD = 3;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data deposits;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input acctno type $ balance;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; select (acctno);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (1) difference = &amp;amp;Diff_DD;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (2) difference = &amp;amp;Diff_SD; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when (4) difference = &amp;amp;Diff_TD; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; otherwise;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {etc}&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jul 2012 15:47:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107485#M22394</guid>
      <dc:creator>tish</dc:creator>
      <dc:date>2012-07-20T15:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Difference to Individual Observation of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107486#M22395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guys Thank you for you reviews in this issue, I was in vacation so sorry for late reply.&lt;/P&gt;&lt;P&gt;@&amp;nbsp; &lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="-1" data-externalid="" data-presence="null" data-userid="480657" data-username="andreas_lds" href="https://communities.sas.com/people/andreas_lds" id="jive-48065745151934039542803"&gt;andreas_lds&lt;/A&gt;&amp;nbsp; &lt;/STRONG&gt; , I need to add the difference to each account for example The new data set must look like as bellow&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1 Demand 11&lt;/P&gt;&lt;P&gt;2 Time 20&lt;/P&gt;&lt;P&gt;3 Demand 10&lt;/P&gt;&lt;P&gt;4 Saving 32&lt;/P&gt;&lt;P&gt;5 Demand 10&lt;/P&gt;&lt;P&gt;6 Saving 30&lt;/P&gt;&lt;P&gt;7 Time 23&lt;/P&gt;&lt;P&gt;8 Saving 30&lt;/P&gt;&lt;P&gt;9 Demand 10&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@ &lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="-1" data-externalid="" data-presence="null" data-userid="808277" data-username="rajat.sas" href="https://communities.sas.com/people/rajat.sas" id="jive-80827745151934074928803"&gt;rajat.sas&lt;/A&gt;&amp;nbsp; you may now understand what actually is the requirement.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;Thank you guys, I appreciate your effort to help..&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;looking Forward&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author "&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Aug 2012 06:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107486#M22395</guid>
      <dc:creator>OniMoni</dc:creator>
      <dc:date>2012-08-11T06:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Difference to Individual Observation of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107487#M22396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why are the values only added some of the time?&amp;nbsp; We can see that you want to sum with the three additional values for demand, time and saving, but you haven't given any clue as to why you are only doing it with certain records.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Aug 2012 14:00:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107487#M22396</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-11T14:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Difference to Individual Observation of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107488#M22397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to apply these changes on every observation, you can do it with one additional statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;balance = balance + &amp;amp;DIFF_DD * (type='Demand') + &amp;amp;DIFF_SD * (type='Saving') + &amp;amp;DIFF_TD * (type='Time');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As others have noted, your intention isn't 100% clear, even based on your revised posting.&amp;nbsp; Why is &amp;amp;DIFF_TD added to "7 TIme 23" but not to "2 Time 20" ?&amp;nbsp; Based on your answer, there will likely be further coding necessary.&amp;nbsp; It won't be difficult, but it will require a clear understanding of what you are trying to achieve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Aug 2012 13:10:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107488#M22397</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-08-12T13:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Difference to Individual Observation of a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107489#M22398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OniMoni, indeed answering Art Tabachneck's question would clear things up.&lt;/P&gt;&lt;P&gt;In the meantime, here is an ever shorter form of Astounding's solution, even making the macro variable unnecessary:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt;balance = balance + (whichc(type, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 9pt;"&gt;'Demand'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 9pt;"&gt;'Saving'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 9pt;"&gt;'Time'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt;Cheers.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 17:12:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-Difference-to-Individual-Observation-of-a-data-set/m-p/107489#M22398</guid>
      <dc:creator>joehinson</dc:creator>
      <dc:date>2012-08-13T17:12:26Z</dc:date>
    </item>
  </channel>
</rss>

