<?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: Update a calculated field in the current table from other fields in the  same table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278193#M55952</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want to run through the SAS free online videos to get a graps of the language if you are new:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  runoff=bal1-bal2;
run;&lt;/PRE&gt;
&lt;P&gt;Assumes of course that all three variables are the same type = numeric. &amp;nbsp;It doesn't matter the number of observations - much like a cursor in SQL, a datastep is a loop of ever observation in the dataset, so that formula gets applied to each row.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jun 2016 13:51:02 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-06-17T13:51:02Z</dc:date>
    <item>
      <title>Update a calculated field in the current table from other fields in the  same table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278188#M55950</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a developer who is new to SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table, myData that has three columns, BAL1, BAL2, and RUNOFF.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I easily,&amp;nbsp;via some kind of datastep or proc SQL, update the RUNOFF&amp;nbsp; = (BAL1-BAL2) (for all of the rows)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are no more that &amp;nbsp;50,000 rows / obs in myData.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kody_Devl&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 13:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278188#M55950</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-06-17T13:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Update a calculated field in the current table from other fields in the  same table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278193#M55952</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want to run through the SAS free online videos to get a graps of the language if you are new:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  runoff=bal1-bal2;
run;&lt;/PRE&gt;
&lt;P&gt;Assumes of course that all three variables are the same type = numeric. &amp;nbsp;It doesn't matter the number of observations - much like a cursor in SQL, a datastep is a loop of ever observation in the dataset, so that formula gets applied to each row.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 13:51:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278193#M55952</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-17T13:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Update a calculated field in the current table from other fields in the  same table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278209#M55953</link>
      <description>&lt;P&gt;It didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Bal1 and Bal2&amp;nbsp;and&amp;nbsp;RunOff&amp;nbsp;are all Numeric 8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BEFORE UPDATE:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Bal1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bal2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RunOff&lt;/P&gt;&lt;P&gt;-154385&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&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;0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AFTER UDPATE;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Bal1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bal2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RunOff&lt;/P&gt;&lt;P&gt;-154385&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&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;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then ran a query to Calculate RunOff and the query returned the same results for RunOff, Blank&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Code Used:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Work.Data_P2_0;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; Work.Data_P2;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;runoff=PremiumWO0-PremiumWO1;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 14:57:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278209#M55953</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-06-17T14:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Update a calculated field in the current table from other fields in the  same table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278221#M55956</link>
      <description>Odd. Any message in the log? Are all variables numeric?</description>
      <pubDate>Fri, 17 Jun 2016 15:40:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278221#M55956</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-06-17T15:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Update a calculated field in the current table from other fields in the  same table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278227#M55957</link>
      <description>&lt;P&gt;No Errors: 0&lt;/P&gt;&lt;P&gt;No Warnings: 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is why I am asking for help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This shouldn't be that hard but somthing is wrong.&lt;/P&gt;&lt;P&gt;Could it be some kind of formatting problem on the numeric 8&amp;nbsp;field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Zero fields were created by SQL when the table is created&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;0 as PremiumWO1&lt;/P&gt;&lt;P&gt;0 as RunOff&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;??&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 15:45:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278227#M55957</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-06-17T15:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Update a calculated field in the current table from other fields in the  same table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278240#M55959</link>
      <description>&lt;P&gt;Post some test data, follow this post for how to get it:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, post the log of the operation.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 16:23:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278240#M55959</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-17T16:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Update a calculated field in the current table from other fields in the  same table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278312#M55987</link>
      <description>&lt;P&gt;I have imported the code but am having trouble with the correct parameters to get it to work.&amp;nbsp; I will have to play with it a bit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kody_devl&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 20:02:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Update-a-calculated-field-in-the-current-table-from-other-fields/m-p/278312#M55987</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-06-17T20:02:58Z</dc:date>
    </item>
  </channel>
</rss>

