<?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: Sum of two numeric variables with different formats using proc SQL in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sum-of-two-numeric-variables-with-different-formats-using-proc/m-p/134569#M10849</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The format of the variable -- used for appearance only in this case -- will not affect the math.&amp;nbsp; You will need to decide what you want the format of the calculated variable to be though.&amp;nbsp; Example that creates one calculation for each:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Consolas; font-size: 11pt;"&gt;&lt;SPAN style="color: #000080; background-color: #ffffff;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; test;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; x &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;&lt;STRONG&gt;8&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; y &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;&lt;STRONG&gt;8&lt;/STRONG&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; x &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;negparen15.2&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;best12.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;x&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; = -&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;&lt;STRONG&gt;1914456.67&lt;/STRONG&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;y = -&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;&lt;STRONG&gt;106213.0235&lt;/STRONG&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; x= y=;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; background-color: #ffffff;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; background-color: #ffffff;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #000080; background-color: #ffffff;"&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; sum&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; x, y,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (x+y) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; sum_negsign format=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;best12.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (x+y) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; sum_negparen format=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;negparen15.2&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; test;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; background-color: #ffffff;"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="font-family: Consolas; font-size: 11pt;"&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="font-family: Consolas; font-size: 11pt;"&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;Chris&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Dec 2014 19:26:32 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2014-12-03T19:26:32Z</dc:date>
    <item>
      <title>Sum of two numeric variables with different formats using proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sum-of-two-numeric-variables-with-different-formats-using-proc/m-p/134567#M10847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;I Have two variables x and y &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;x has a format - NEGPAREN15.2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;informat - comma 15.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;length 8 &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;y variable has format&amp;nbsp; - best12.&lt;/P&gt;&lt;P&gt;Informat - best12.&lt;/P&gt;&lt;P&gt;length -8&lt;/P&gt;&lt;P&gt;both are numeric variables&lt;/P&gt;&lt;P&gt;how to add both of them &lt;/P&gt;&lt;P&gt;i want z&amp;nbsp; variable which is sum of x and y &lt;/P&gt;&lt;P&gt;hhow to do in proc SQL and what format I need to assign to z variable &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;X Has values like (1,914,456.67)&lt;/P&gt;&lt;P&gt;Y has values like -106213.0235&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 18:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sum-of-two-numeric-variables-with-different-formats-using-proc/m-p/134567#M10847</guid>
      <dc:creator>chennupriya</dc:creator>
      <dc:date>2014-12-03T18:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of two numeric variables with different formats using proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sum-of-two-numeric-variables-with-different-formats-using-proc/m-p/134568#M10848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The format of a numeric variable is only a way to display the value in a report but it does not change anything in the variable so the way to code the sum is as simple as&lt;/P&gt;&lt;P&gt;select &lt;STRONG&gt;x+y as z&lt;/STRONG&gt; in sql or &lt;STRONG&gt;z=x+y&lt;/STRONG&gt; in a data step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can assign any format to z.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CTorres&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 19:24:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sum-of-two-numeric-variables-with-different-formats-using-proc/m-p/134568#M10848</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2014-12-03T19:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of two numeric variables with different formats using proc SQL</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sum-of-two-numeric-variables-with-different-formats-using-proc/m-p/134569#M10849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The format of the variable -- used for appearance only in this case -- will not affect the math.&amp;nbsp; You will need to decide what you want the format of the calculated variable to be though.&amp;nbsp; Example that creates one calculation for each:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Consolas; font-size: 11pt;"&gt;&lt;SPAN style="color: #000080; background-color: #ffffff;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; test;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; x &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;&lt;STRONG&gt;8&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; y &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;&lt;STRONG&gt;8&lt;/STRONG&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; x &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;negparen15.2&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;best12.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;x&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; = -&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;&lt;STRONG&gt;1914456.67&lt;/STRONG&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;y = -&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;&lt;STRONG&gt;106213.0235&lt;/STRONG&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; x= y=;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; background-color: #ffffff;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; background-color: #ffffff;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #000080; background-color: #ffffff;"&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;create&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;table&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; sum&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; x, y,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (x+y) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; sum_negsign format=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;best12.&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (x+y) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; sum_negparen format=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;negparen15.2&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; test;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000080; background-color: #ffffff;"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="font-family: Consolas; font-size: 11pt;"&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="font-family: Consolas; font-size: 11pt;"&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;Chris&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2014 19:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sum-of-two-numeric-variables-with-different-formats-using-proc/m-p/134569#M10849</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2014-12-03T19:26:32Z</dc:date>
    </item>
  </channel>
</rss>

