<?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: SAS reading 0.07 string as scientific - still in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970779#M377157</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/476228"&gt;@abigail_greenh&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To convert the 21-character string "7.0000000000000007E-2" to a numeric value, use an informat with a length &amp;gt;=21, for example the &lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;32.&lt;/STRONG&gt; &lt;/FONT&gt;informat:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;num_PW=input(PW, &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;32.&lt;/STRONG&gt;&lt;/FONT&gt;);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The informat &lt;FONT face="courier new,courier"&gt;BEST12.&lt;/FONT&gt; (which is just an alias of &lt;FONT face="courier new,courier"&gt;12.&lt;/FONT&gt;) has only length 12 and hence would miss the important "E-2" information, resulting in the integer value 7. Also note that the "&lt;EM&gt;w&amp;nbsp;&lt;/EM&gt;" (written in italics) in format and informat names found in the SAS documentation must always be replaced by a numeric width specification (and "&lt;EM&gt;d&lt;/EM&gt; " by a number of decimals, but these are not needed in your example).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can confirm that 0.07 is stored as&amp;nbsp;7.0000000000000007E-2 in an .xlsx file created with Excel 2013 on Windows 10. After unzipping the underlying xml files of an Excel sheet containing the numbers 0.01, 0.02, ..., 0.11 I see that, among these 11 numbers, only 0.07 has that precision issue. Here is an excerpt of sheet1.xml:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;...
&amp;lt;row r="6" spans="1:1" x14ac:dyDescent="0.25"&amp;gt;&amp;lt;c r="A6"&amp;gt;&amp;lt;v&amp;gt;0.06&amp;lt;/v&amp;gt;&amp;lt;/c&amp;gt;&amp;lt;/row&amp;gt;
&amp;lt;row r="7" spans="1:1" x14ac:dyDescent="0.25"&amp;gt;&amp;lt;c r="A7"&amp;gt;&amp;lt;v&amp;gt;7.0000000000000007E-2&amp;lt;/v&amp;gt;&amp;lt;/c&amp;gt;&amp;lt;/row&amp;gt;
&amp;lt;row r="8" spans="1:1" x14ac:dyDescent="0.25"&amp;gt;&amp;lt;c r="A8"&amp;gt;&amp;lt;v&amp;gt;0.08&amp;lt;/v&amp;gt;&amp;lt;/c&amp;gt;&amp;lt;/row&amp;gt;
...&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found several discussions of this Excel problem on the web from 2009 and later years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Addendum: By the way, the internal binary representation of 0.07 in SAS on Windows and Unix platforms, mathematically translated back to the decimal system, equals&lt;/P&gt;
&lt;PRE&gt;0.070000000000000006661338147750939242541790008544921875&lt;/PRE&gt;
&lt;P&gt;Rounded to 18 decimals, this matches the value&amp;nbsp;7.0000000000000007E-2 seen in Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Addendum 2: SAS (at least my Windows SAS 9.4M5) would interpret the numeric literal&amp;nbsp;&lt;FONT face="courier new,courier"&gt;7.0000000000000007E-2&lt;/FONT&gt; as the same value as &lt;FONT face="courier new,courier"&gt;0.07&lt;/FONT&gt;,&lt;/P&gt;
&lt;PRE&gt;45    data _null_;
46    if 7.0000000000000007E-2=0.07 then put 'OK';
47    run;

OK&lt;/PRE&gt;
&lt;P&gt;although&amp;nbsp;the internal representation corresponding to that decimal fraction, derived&amp;nbsp;mathematically, would have a numeric value slightly greater than 0.07 (see &lt;A href="https://communities.sas.com/t5/SAS-Programming/SAS-mis-reading-numeric-columns/m-p/926628/highlight/true#M364650" target="_blank" rel="noopener"&gt;this 2024 post&lt;/A&gt; for more details).&lt;/P&gt;</description>
    <pubDate>Tue, 15 Jul 2025 13:57:16 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2025-07-15T13:57:16Z</dc:date>
    <item>
      <title>SAS reading 0.07 string as scientific - still</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970759#M377147</link>
      <description>&lt;P&gt;I found an identical topic posted in 2017 and have the same issue, which was not solved despite the lock. The listed solution is not correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imported a huge dataset from Excel and converted a few selected variables to numerical. On conversion, SAS reads only the value 0.07 incorrectly, as&amp;nbsp;7.0000000000000007E-2. It does this in every instance and every other value is correct. The cell(s) do not have any other hidden values, and contain only the characters "0.07" even when expanded, so it's not a case of hidden extra decimals. I tried copy-pasting a value from a different cell and changing it to 0.07. To convert the string to a numerical value, I tried best12, bestw, and bestd.w.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc import out=site
datafile="file.xlsx"
dbms=xlsx replace;
sheet="sheet";
getnames=yes;

data site_num;
set site;
num_PW=input(PW, BESTw.);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2025 22:31:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970759#M377147</guid>
      <dc:creator>abigail_greenh</dc:creator>
      <dc:date>2025-07-14T22:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS reading 0.07 string as scientific - still</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970760#M377148</link>
      <description>&lt;P&gt;Can you share a cut-down version of your Excel that shows this behaviour? Ideally an Excel with only one sheet and one row of data and the SAS code to read it that then returns the undesired result.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2025 02:01:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970760#M377148</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2025-07-15T02:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAS reading 0.07 string as scientific - still</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970761#M377149</link>
      <description>&lt;P&gt;You might want to open a ticket with SAS support so that you can share your actual file with them and they can see if the behavior is the same on other versions of SAS running on different hardware.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that if you are importing from an XLSX file then SAS is not reading a STRING .&amp;nbsp; It is converting the floating point number you have stored in the XLSX file into the floating point number you have in the SAS dataset.&amp;nbsp; If it was reading it as a string it would have made a character variable in SAS.&amp;nbsp; So the issue might be on the EXCEL side.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2025 00:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970761#M377149</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-07-15T00:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS reading 0.07 string as scientific - still</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970779#M377157</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/476228"&gt;@abigail_greenh&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To convert the 21-character string "7.0000000000000007E-2" to a numeric value, use an informat with a length &amp;gt;=21, for example the &lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;32.&lt;/STRONG&gt; &lt;/FONT&gt;informat:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;num_PW=input(PW, &lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;32.&lt;/STRONG&gt;&lt;/FONT&gt;);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The informat &lt;FONT face="courier new,courier"&gt;BEST12.&lt;/FONT&gt; (which is just an alias of &lt;FONT face="courier new,courier"&gt;12.&lt;/FONT&gt;) has only length 12 and hence would miss the important "E-2" information, resulting in the integer value 7. Also note that the "&lt;EM&gt;w&amp;nbsp;&lt;/EM&gt;" (written in italics) in format and informat names found in the SAS documentation must always be replaced by a numeric width specification (and "&lt;EM&gt;d&lt;/EM&gt; " by a number of decimals, but these are not needed in your example).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can confirm that 0.07 is stored as&amp;nbsp;7.0000000000000007E-2 in an .xlsx file created with Excel 2013 on Windows 10. After unzipping the underlying xml files of an Excel sheet containing the numbers 0.01, 0.02, ..., 0.11 I see that, among these 11 numbers, only 0.07 has that precision issue. Here is an excerpt of sheet1.xml:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;...
&amp;lt;row r="6" spans="1:1" x14ac:dyDescent="0.25"&amp;gt;&amp;lt;c r="A6"&amp;gt;&amp;lt;v&amp;gt;0.06&amp;lt;/v&amp;gt;&amp;lt;/c&amp;gt;&amp;lt;/row&amp;gt;
&amp;lt;row r="7" spans="1:1" x14ac:dyDescent="0.25"&amp;gt;&amp;lt;c r="A7"&amp;gt;&amp;lt;v&amp;gt;7.0000000000000007E-2&amp;lt;/v&amp;gt;&amp;lt;/c&amp;gt;&amp;lt;/row&amp;gt;
&amp;lt;row r="8" spans="1:1" x14ac:dyDescent="0.25"&amp;gt;&amp;lt;c r="A8"&amp;gt;&amp;lt;v&amp;gt;0.08&amp;lt;/v&amp;gt;&amp;lt;/c&amp;gt;&amp;lt;/row&amp;gt;
...&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found several discussions of this Excel problem on the web from 2009 and later years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Addendum: By the way, the internal binary representation of 0.07 in SAS on Windows and Unix platforms, mathematically translated back to the decimal system, equals&lt;/P&gt;
&lt;PRE&gt;0.070000000000000006661338147750939242541790008544921875&lt;/PRE&gt;
&lt;P&gt;Rounded to 18 decimals, this matches the value&amp;nbsp;7.0000000000000007E-2 seen in Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Addendum 2: SAS (at least my Windows SAS 9.4M5) would interpret the numeric literal&amp;nbsp;&lt;FONT face="courier new,courier"&gt;7.0000000000000007E-2&lt;/FONT&gt; as the same value as &lt;FONT face="courier new,courier"&gt;0.07&lt;/FONT&gt;,&lt;/P&gt;
&lt;PRE&gt;45    data _null_;
46    if 7.0000000000000007E-2=0.07 then put 'OK';
47    run;

OK&lt;/PRE&gt;
&lt;P&gt;although&amp;nbsp;the internal representation corresponding to that decimal fraction, derived&amp;nbsp;mathematically, would have a numeric value slightly greater than 0.07 (see &lt;A href="https://communities.sas.com/t5/SAS-Programming/SAS-mis-reading-numeric-columns/m-p/926628/highlight/true#M364650" target="_blank" rel="noopener"&gt;this 2024 post&lt;/A&gt; for more details).&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2025 13:57:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970779#M377157</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2025-07-15T13:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS reading 0.07 string as scientific - still</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970816#M377176</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;Thank you, that makes sense and is a fun little piece of Excel trivia to share with my colleagues. I'm required to use these file formats in my workplace, so do you know if there's anything I can do on the SAS or Excel side to display the correct decimal number?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2025 16:15:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970816#M377176</guid>
      <dc:creator>abigail_greenh</dc:creator>
      <dc:date>2025-07-15T16:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAS reading 0.07 string as scientific - still</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970817#M377177</link>
      <description>&lt;P&gt;Are there cases in your data where&amp;nbsp;&lt;FONT face="courier new,courier"&gt;num_PW=input(PW, 32.)&lt;/FONT&gt; does not contain the "&lt;SPAN&gt;correct decimal number", t&lt;/SPAN&gt;&lt;SPAN&gt;hat is, where a check like&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;371   data _null_;
372   PW="7.0000000000000007E-2";
373   num_PW=input(PW, 32.);
374   if num_PW=0.07 then put 'OK';
375   run;

OK&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;would&amp;nbsp;&lt;EM&gt;not&lt;/EM&gt; yield "OK"? If so, I would use the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0tj6cmga7p8qln1ejh6ebevm0c9.htm" target="_blank" rel="noopener"&gt;ROUND function&lt;/A&gt; with an appropriate rounding unit in the definition of &lt;FONT face="courier new,courier"&gt;num_PW&lt;/FONT&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#999999"&gt;412   data _null_;
413   PW="7.00000000000000&lt;FONT color="#000000"&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;&lt;/FONT&gt;E-2";
414   num_PW=&lt;FONT color="#000000"&gt;&lt;STRONG&gt;round(&lt;/STRONG&gt;&lt;/FONT&gt;input(PW, 32.)&lt;STRONG&gt;&lt;FONT color="#000000"&gt;, 1e-14)&lt;/FONT&gt;&lt;/STRONG&gt;;
415   if num_PW=0.07 then put 'OK';
416   run;

&lt;FONT color="#000000"&gt;&lt;STRONG&gt;OK&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2025 16:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-reading-0-07-string-as-scientific-still/m-p/970817#M377177</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2025-07-15T16:44:09Z</dc:date>
    </item>
  </channel>
</rss>

