<?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: macro and scientific notation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-and-scientific-notation/m-p/353792#M273907</link>
    <description>&lt;P&gt;I'm not sure this is the "why" for this particular case, but there is a general principle.&amp;nbsp; If you assign a format to a variable, SAS goes out of its way to respect the width of the format.&amp;nbsp; With a comma w.d format, SAS will do whatever it takes to express the value with a width of "w" (including using scientific notation of necessary).&lt;/P&gt;</description>
    <pubDate>Wed, 26 Apr 2017 17:19:12 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-04-26T17:19:12Z</dc:date>
    <item>
      <title>macro and scientific notation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-and-scientific-notation/m-p/353776#M273904</link>
      <description>&lt;P&gt;okay, so i imported a couple of tables and am building a table out of the data.&amp;nbsp; the table is 5x5.&amp;nbsp; so i have 4 columns that need to be summed and put into fields then i need to subtract those fields to fill in the third row.&amp;nbsp; so after searching i found i could use macro variables to get the data inot variables and subtract them..&amp;nbsp; however, the column i am summing, even though i put the format importing as commaw.d, after summing is getting put into the table in **bleep** scientific notation which i cannot understand why since the columns are set up as decimal 20,2 which should be enough room for anything but it INSISTS!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so now when i subtract the variables, i get an error and cannot figure out how to get the values into numeric format so i can evaluate.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS Output&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;SOURCE COMMERCIAL_01 CONSTRUCTION_01 COMMERCIAL_02 CONSTRUCTION_02 &amp;nbsp; &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Apr File&lt;/TD&gt;&lt;TD&gt;98452574&lt;/TD&gt;&lt;TD&gt;3185241&lt;/TD&gt;&lt;TD&gt;-256020&lt;/TD&gt;&lt;TD&gt;-5.679E7&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Mar File&lt;/TD&gt;&lt;TD&gt;41736721&lt;/TD&gt;&lt;TD&gt;2.0938E8&lt;/TD&gt;&lt;TD&gt;-1.319E7&lt;/TD&gt;&lt;TD&gt;-3.514E7&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Current Months File&lt;/TD&gt;&lt;TD&gt;56715853&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Current Months S File&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Difference&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="branch"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="branch"&gt;this is the table.&amp;nbsp; i need to subtract the bottom from the top and put that in the third line below.&amp;nbsp; here is the code...&lt;/DIV&gt;&lt;DIV class="branch"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="branch"&gt;data RPT01;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;set RPT01;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;CONSTRUCTION_01=input(CONSTRUCTION_XOFF,15.2);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;COMMERCIAL_02=input(COMMERCIAL_RECOV,15.2);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;CONSTUCTION_02=input(CONSTRUCTION_RECOV,15.2);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%macro calcs01;&lt;BR /&gt;%local oper;&lt;BR /&gt;%do;&lt;BR /&gt;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select COMMERCIAL_01&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;into :COMMXO01 - :COMMXO02&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;from RPT01;&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select CONSTRUCTION_01&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;into :CONSTXO01 - :CONSTXO02&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;from RPT01;&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select COMMERCIAL_02&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;into :COMMRE01 - :COMMRE02&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;from RPT01;&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select CONSTRUCTION_02&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;into :CONSTRE01 - :CONSTRE02&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;from RPT01;&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;%let oper=-;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;update RPT01&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;set COMMERCIAL_01=%eval(&amp;amp;COMMXO01 &amp;amp;oper &amp;amp;COMMXO02)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;where SOURCE='Current Months GLFBS';&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;update RPT01&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;set CONSTRUCTION_01=%eval(&amp;amp;CONSTXO01 &amp;amp;oper &amp;amp;CONSTXO02)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;where SOURCE like '%GLFBS';&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;update RPT01&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;set COMMERCIAL_02=%eval(&amp;amp;COMMRE01 &amp;amp;oper &amp;amp;COMMRE02)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;where SOURCE like '%GLFBS';&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;%end;&lt;BR /&gt;%mend calcs01;&lt;BR /&gt;%run;&lt;BR /&gt;&lt;BR /&gt;%calcs01&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;select *&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;from RPT01;&lt;BR /&gt;;&lt;/DIV&gt;&lt;DIV class="branch"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="branch"&gt;so it works correctly in the first column and then fails for the others with this as an example...&lt;/DIV&gt;&lt;DIV class="branch"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="branch"&gt;NOTE 137-205: Line generated by the invoked macro "CALCS01".&lt;BR /&gt;90&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sql; update RPT01&amp;nbsp; set COMMERCIAL_01=%eval(&amp;amp;COMMXO01 &amp;amp;oper &amp;amp;COMMXO02)&amp;nbsp; where SOURCE='Current Months GLFBS'; ;&lt;BR /&gt;90&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ! proc sql; update RPT01&amp;nbsp; set CONSTRUCTION_01=%eval(&amp;amp;CONSTXO01 &amp;amp;oper &amp;amp;CONSTXO02)&amp;nbsp; where SOURCE like '%GLFBS'; ;&amp;nbsp; proc sql&lt;BR /&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;&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ______&lt;BR /&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;&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22&lt;BR /&gt;90&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ! ; update&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: (, WHERE. &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3185241 - 2.0938E8&lt;/DIV&gt;&lt;DIV class="branch"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="branch"&gt;i dont get this or how to fix it.&amp;nbsp; i am using sas eg.&amp;nbsp; any help would be very much appreciated.&amp;nbsp; i have spent several hours and have reached a high level of frustration on this stupid problem.&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="branch"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="branch"&gt;thanks&lt;/DIV&gt;</description>
      <pubDate>Wed, 26 Apr 2017 16:15:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-and-scientific-notation/m-p/353776#M273904</guid>
      <dc:creator>me55</dc:creator>
      <dc:date>2017-04-26T16:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: macro and scientific notation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-and-scientific-notation/m-p/353781#M273905</link>
      <description>&lt;P&gt;Switch from %EVAL to %SYSEVALF.&amp;nbsp; %EVAL works with integers only, but %SYSEVALF can work with both decimal fractions and scientific notation.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 16:23:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-and-scientific-notation/m-p/353781#M273905</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-26T16:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: macro and scientific notation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-and-scientific-notation/m-p/353790#M273906</link>
      <description>&lt;P&gt;thanks astounding.&amp;nbsp; that worked perfectly.&amp;nbsp; one further thing, why is the data being put into sci format and how can i put it into numeric format (integers, decimals)?&amp;nbsp; everything works as is and i know i can pull using a format so it is not there but for my curiosity...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 17:10:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-and-scientific-notation/m-p/353790#M273906</guid>
      <dc:creator>me55</dc:creator>
      <dc:date>2017-04-26T17:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: macro and scientific notation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-and-scientific-notation/m-p/353792#M273907</link>
      <description>&lt;P&gt;I'm not sure this is the "why" for this particular case, but there is a general principle.&amp;nbsp; If you assign a format to a variable, SAS goes out of its way to respect the width of the format.&amp;nbsp; With a comma w.d format, SAS will do whatever it takes to express the value with a width of "w" (including using scientific notation of necessary).&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 17:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-and-scientific-notation/m-p/353792#M273907</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-26T17:19:12Z</dc:date>
    </item>
  </channel>
</rss>

