<?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 get a numeric value with 12 digits after decimal from excel worksheet in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285648#M58450</link>
    <description>&lt;P&gt;Both SAS and Excel store the same floating point numbers, their precision is dictated by the computer floating point unit. What you see is a representation of those numbers dictated by the numeric format of spreadsheet cells (Excel) or variables (SAS). Change the format, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi﻿&lt;/a&gt;&amp;nbsp;suggested, and you will see a different representation of the number.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jul 2016 21:48:31 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2016-07-19T21:48:31Z</dc:date>
    <item>
      <title>How to get a numeric value with 12 digits after decimal from excel worksheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285626#M58437</link>
      <description>&lt;P&gt;Hi SAS community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am working to import data from excel worksheet into sas datasets.&lt;/P&gt;
&lt;P&gt;I use proc import :&lt;/P&gt;
&lt;P&gt;proc import datafile=&amp;lt;infile&amp;gt;. out=&amp;lt;outfile&amp;gt;. dbms=excel replace;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;DBDSOPTS="FIRSTOBS=9 DBSASTYPE=( " F1='CHAR(20)' F2='NUMERIC(8)' F3='NUMERIC(8)' F4='NUMERIC(8)' ");&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;sheet="sheet1";&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;getnames=no;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of rows on excel worksheet is : (12 digits after decimal)&lt;/P&gt;
&lt;TABLE width="650"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;location A&lt;/TD&gt;
&lt;TD width="148"&gt;89.205247050640&lt;/TD&gt;
&lt;TD width="170"&gt;95.898600110359&lt;/TD&gt;
&lt;TD width="173"&gt;98.293041120003&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;My proc import only read: ( 9 digits after decimal)&lt;/P&gt;
&lt;TABLE width="650"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;location A&lt;/TD&gt;
&lt;TD width="148"&gt;89.205247050&lt;/TD&gt;
&lt;TD width="170"&gt;95.898600110&lt;/TD&gt;
&lt;TD width="173"&gt;
&lt;P&gt;98.293041120&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="159"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="148"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="170"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="173"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Can you show me any method to get the full digits (12 digits) after decimal.&lt;/P&gt;
&lt;P&gt;Thanks for your support.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WTien1968&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 20:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285626#M58437</guid>
      <dc:creator>wtien196838</dc:creator>
      <dc:date>2016-07-19T20:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a numeric value with 12 digits after decimal from excel worksheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285632#M58441</link>
      <description>&lt;P&gt;Apply a format statement to your SAS dataset like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
format F2 15.12;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 20:46:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285632#M58441</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-07-19T20:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a numeric value with 12 digits after decimal from excel worksheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285648#M58450</link>
      <description>&lt;P&gt;Both SAS and Excel store the same floating point numbers, their precision is dictated by the computer floating point unit. What you see is a representation of those numbers dictated by the numeric format of spreadsheet cells (Excel) or variables (SAS). Change the format, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi﻿&lt;/a&gt;&amp;nbsp;suggested, and you will see a different representation of the number.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 21:48:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285648#M58450</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-07-19T21:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a numeric value with 12 digits after decimal from excel worksheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285670#M58454</link>
      <description>&lt;P&gt;Hi PGstats,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your quick response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even I set the format of variable to 15.12, the number that I got in sas dataset still is 9 digits after decimal.&lt;/P&gt;
&lt;P&gt;Is it due to my computer hardware restricted or sas options set up ?&lt;/P&gt;
&lt;P&gt;I use base SAS 9.3 both local and server.&lt;/P&gt;
&lt;P&gt;Any one welcome to suggest your idea.&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;WTien1968&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 23:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285670#M58454</guid>
      <dc:creator>wtien196838</dc:creator>
      <dc:date>2016-07-19T23:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a numeric value with 12 digits after decimal from excel worksheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285677#M58459</link>
      <description>&lt;P&gt;Hi PGStats,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your solution is correct. It is my mistake that I set up the format with new variable name.&lt;/P&gt;
&lt;P&gt;After proc import:&lt;/P&gt;
&lt;P&gt;Data test;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set &amp;lt;outfile&amp;gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; rename F1=location&amp;nbsp; F2=per_1&amp;nbsp; F3=per_2&amp;nbsp;&amp;nbsp; F4=per_3 ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; format per_1&amp;nbsp; per_2&amp;nbsp; per_3&amp;nbsp;&amp;nbsp;&amp;nbsp; 15.12;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;It suppose to code: format F2 F3 F4 15.12 ;&lt;/P&gt;
&lt;P&gt;then rename later.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again for your solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WTien1968&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 23:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285677#M58459</guid>
      <dc:creator>wtien196838</dc:creator>
      <dc:date>2016-07-19T23:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a numeric value with 12 digits after decimal from excel worksheet</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285716#M58473</link>
      <description>&lt;P&gt;I can't reproduce your proc import step. There seems to be some incompatibility between &lt;STRONG&gt;FIRSTOBS=&lt;/STRONG&gt; and &lt;STRONG&gt;getnames=no&lt;/STRONG&gt; with proc Import.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However I could do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname xl excel "&amp;amp;sasforum\datasets\test12.xlsx" access=readonly header=no;

proc sql;
create table outfile as
select F1, 
    F2 format=15.12,
    F3 format=15.12,
    F4 format=15.12
from xl.'Sheet1$'n(firstobs=9 DBSASTYPE=(F1='CHAR(20)' F2='NUMERIC(8)' F3='NUMERIC(8)' F4='NUMERIC(8)'));
select * from outfile;
quit;

libname xl clear;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and get all 12 decimals in the printout.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 02:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-numeric-value-with-12-digits-after-decimal-from/m-p/285716#M58473</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-07-20T02:31:10Z</dc:date>
    </item>
  </channel>
</rss>

