<?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: How to calculate values from the column and store the same into new columns?? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-values-from-the-column-and-store-the-same-into/m-p/565340#M158711</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/271305"&gt;@sdhilip&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;(...)&lt;/P&gt;
&lt;P&gt;I made the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want2;
set want;
AE = residual ** residual;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(...) I want to square the residual column and store into AE.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/271305"&gt;@sdhilip&lt;/a&gt;&amp;nbsp;(and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261618"&gt;@heffo&lt;/a&gt;),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It might be too late, but to store the square of a non-missing value of variable&amp;nbsp;&lt;FONT face="courier new,courier"&gt;residual&lt;/FONT&gt; in variable &lt;FONT face="courier new,courier"&gt;AE&lt;/FONT&gt; you should use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;AE=residual**2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;AE=residual*residual;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;whereas &lt;FONT face="courier new,courier"&gt;residual**residual&lt;/FONT&gt; would be &lt;FONT face="courier new,courier"&gt;residual&lt;/FONT&gt; raised to the power of &lt;FONT face="courier new,courier"&gt;residual&lt;/FONT&gt;, which is a very different calculation: compare 8**2=8*8=64 to 8**8=8*8*8*8*8*8*8*8=16777216 and note that (-0.5)**2=0.25, whereas&amp;nbsp;(-0.5)**(-0.5) is not even a real number and therefore results in a missing value in SAS (plus log messages like "Invalid argument ...").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2019 17:53:14 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2019-06-11T17:53:14Z</dc:date>
    <item>
      <title>How to calculate values from the column and store the same into new columns??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-values-from-the-column-and-store-the-same-into/m-p/556598#M155052</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having below datasets,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a new column called AE and do the calculation of residual ** residual.&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="Capture.JPG" style="width: 379px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29245i23E71F70BD56FDD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want2;
set want;
AE = residual ** residual;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The column residuals have both negative and positive values. I am not getting value for the negative one after performed residuals ** residual (Square). Anybody can advise what went wrong. I want to square the residual column and store into AE. Please see below screenshot&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="Capture.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29246iADB8BDE55BFF70CF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&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;&lt;P&gt;My second question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the above table, you can see the column name called forecast which has both negative and positive values. I want to copy the same value with a positive sign and store into a new column called absolute. ( All negative value should become positive without changing the value and positive remains the same. Ex: -0.005, 0.123 I need 0.005, 0.123 in the new column absolute)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using SAS Enterprise Guide. I tried with the Query builder also but not successful. Please advise how to do the above two problems in coding as well as using query builder if possible.&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;Dhilip&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 22:14:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-values-from-the-column-and-store-the-same-into/m-p/556598#M155052</guid>
      <dc:creator>sdhilip</dc:creator>
      <dc:date>2019-05-06T22:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate values from the column and store the same into new columns??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-values-from-the-column-and-store-the-same-into/m-p/556603#M155055</link>
      <description>&lt;P&gt;It seems like SAS has some problems with negativity and exponential. So you can try the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want2;
	set want;
	AE=sign(residual)*abs(residual)**residual;
	Absolute = abs(residual);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 May 2019 22:29:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-values-from-the-column-and-store-the-same-into/m-p/556603#M155055</guid>
      <dc:creator>heffo</dc:creator>
      <dc:date>2019-05-06T22:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate values from the column and store the same into new columns??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-values-from-the-column-and-store-the-same-into/m-p/565340#M158711</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/271305"&gt;@sdhilip&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;(...)&lt;/P&gt;
&lt;P&gt;I made the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want2;
set want;
AE = residual ** residual;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(...) I want to square the residual column and store into AE.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/271305"&gt;@sdhilip&lt;/a&gt;&amp;nbsp;(and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261618"&gt;@heffo&lt;/a&gt;),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It might be too late, but to store the square of a non-missing value of variable&amp;nbsp;&lt;FONT face="courier new,courier"&gt;residual&lt;/FONT&gt; in variable &lt;FONT face="courier new,courier"&gt;AE&lt;/FONT&gt; you should use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;AE=residual**2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;AE=residual*residual;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;whereas &lt;FONT face="courier new,courier"&gt;residual**residual&lt;/FONT&gt; would be &lt;FONT face="courier new,courier"&gt;residual&lt;/FONT&gt; raised to the power of &lt;FONT face="courier new,courier"&gt;residual&lt;/FONT&gt;, which is a very different calculation: compare 8**2=8*8=64 to 8**8=8*8*8*8*8*8*8*8=16777216 and note that (-0.5)**2=0.25, whereas&amp;nbsp;(-0.5)**(-0.5) is not even a real number and therefore results in a missing value in SAS (plus log messages like "Invalid argument ...").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 17:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-values-from-the-column-and-store-the-same-into/m-p/565340#M158711</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-06-11T17:53:14Z</dc:date>
    </item>
  </channel>
</rss>

