<?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 import excel values correctly into SAS dataset ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262447#M51230</link>
    <description>&lt;P&gt;Is that your full code? Where's the input statement?&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2016 14:29:24 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-04-08T14:29:24Z</dc:date>
    <item>
      <title>How to import excel values correctly into SAS dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262231#M51151</link>
      <description>&lt;P&gt;Dear SAS user community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;My user passed me an Excel report which has columns of data.&lt;/P&gt;
&lt;P&gt;For example, one cell of a column has 82.5%&amp;nbsp; (real value is 82.4678901235%).&lt;/P&gt;
&lt;P&gt;I extract from database to get the value of that cell which is exactly 82.4678901235.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I use sas proc compare, the result is mismatched due to 82.5 vs 82.4678901235.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would you show me a solution to this issue ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS: if I changed&amp;nbsp; all values of&amp;nbsp; excel report format to real values, the proc compare created a matched result report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;William&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 22:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262231#M51151</guid>
      <dc:creator>wtien196838</dc:creator>
      <dc:date>2016-04-07T22:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to import excel values correctly into SAS dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262235#M51154</link>
      <description>&lt;P&gt;I'm not sure I quite follow. Did you import the data into SAS from Excel or some other database, or both?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you saying the value of 82.4678901235 did or did not appear in the SAS data set? And from which source(see previous question).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you imported data into SAS from Excel describe what method you used. Ditto if reading from another database.&lt;/P&gt;
&lt;P&gt;If is possible that the displayed value from Excel is what SAS received depending upon the method used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2016 23:08:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262235#M51154</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-07T23:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to import excel values correctly into SAS dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262266#M51166</link>
      <description>&lt;P&gt;I read a range of cells in each excel worksheet. I use DDE to read the value of each cell. Use informat to code each variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also extract data from same user oracle database to compare.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In short, user data and my data are the same. Only user present data in excel format is differ to the real value (rounding issue).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Is what you see&lt;/STRONG&gt; (values in the excel cell) &lt;STRONG&gt;if what you get&lt;/STRONG&gt; (rounding number) in reading excel cells into sas datasset ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example: real value is&amp;nbsp;&lt;SPAN&gt;82.4678901235, excel format 82.5 and sas read in 82.5000000000 (informat 13.10).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My question is how can I read in from excel the real value so that the proc compare user data (read from excel) and my data (read from oracle database) MATCHING ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 02:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262266#M51166</guid>
      <dc:creator>wtien196838</dc:creator>
      <dc:date>2016-04-08T02:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to import excel values correctly into SAS dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262285#M51168</link>
      <description>&lt;P&gt;Please post the DDE code you used to read in the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you correctly specify your informat? In this case you may want to try BEST32. as an informat to read the file correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 03:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262285#M51168</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-08T03:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to import excel values correctly into SAS dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262300#M51170</link>
      <description>&lt;P&gt;This is because Excel is not a sensible transfer medium and the internal Excel file format is not a suitable format for data transfer.&lt;/P&gt;
&lt;P&gt;If someone wants to send you test data from a database query, they should unload that into a csv or fixed column file and send you that.&lt;/P&gt;
&lt;P&gt;As long as you use Excel as the medium, you will have a constant PITA.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 06:10:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262300#M51170</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-08T06:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to import excel values correctly into SAS dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262422#M51216</link>
      <description>&lt;P&gt;/* Open Excel file */&lt;/P&gt;
&lt;P&gt;PROC FORMAT;&lt;BR /&gt; INVALUE TPERC&lt;BR /&gt; 'N/A' = .&lt;BR /&gt; '-' = 999&lt;BR /&gt; '#VALUE!' = 999&lt;BR /&gt; '#DIV/0!' = 999&lt;BR /&gt; other =[17.10]&lt;BR /&gt; ;&lt;/P&gt;
&lt;P&gt;Filename inputf DDE "excel|tabname r10c5:r20c6 notab lrecl=32000; /* sample 2 columns */&lt;/P&gt;
&lt;P&gt;Data test ;&lt;BR /&gt; infile inputf dlm='09'x DSD Missover PAD;&lt;BR /&gt; informat&lt;BR /&gt; description $100&lt;BR /&gt; quarter_per TPERC&lt;BR /&gt; ;&lt;BR /&gt; run;&lt;BR /&gt;---------------------------------------&lt;BR /&gt; Excel report:&lt;BR /&gt; Location &amp;nbsp; &amp;nbsp;&amp;nbsp; Qtr_percent&lt;BR /&gt; East region&amp;nbsp; 82.5 % (excel format decimal = 1) or 82.4678901235% (format decimal=10) &lt;BR /&gt; .... .....&lt;/P&gt;
&lt;P&gt;I need to verify the correctness of this report. SAS pull from database the real value&lt;BR /&gt;82.4678901235 but sas read in the excel value 82.5000000000.&lt;BR /&gt; AS a result, proc compare showed mismatch on the cell.&lt;BR /&gt; I CAN NOT modify the user report, change all numbers format to decimal=10. If this is the case, &lt;BR /&gt;proc compare showed MATCHING.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 13:30:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262422#M51216</guid>
      <dc:creator>wtien196838</dc:creator>
      <dc:date>2016-04-08T13:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to import excel values correctly into SAS dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262447#M51230</link>
      <description>&lt;P&gt;Is that your full code? Where's the input statement?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 14:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262447#M51230</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-08T14:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to import excel values correctly into SAS dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262457#M51237</link>
      <description>&lt;P&gt;sorry the code :&lt;/P&gt;
&lt;P&gt;informat&lt;BR /&gt; description $100&lt;BR /&gt; quarter_per TPERC&lt;BR /&gt; ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;should be read&lt;/P&gt;
&lt;P&gt;input&lt;BR /&gt; description $100&lt;BR /&gt; quarter_per TPERC&lt;BR /&gt; ;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 14:45:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262457#M51237</guid>
      <dc:creator>wtien196838</dc:creator>
      <dc:date>2016-04-08T14:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to import excel values correctly into SAS dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262465#M51245</link>
      <description>&lt;P&gt;So you don't have an informat specified for your numeric variable. Try using best32. and seeing your results. As I indicated earlier...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;informat&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;description $100&lt;/SPAN&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;quarter_per TPERC best32.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 14:56:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262465#M51245</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-08T14:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to import excel values correctly into SAS dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262477#M51251</link>
      <description>&lt;P&gt;Proc format assigned the value 17.10&amp;nbsp; (in TPERC) when sas read in the excel cell value.&lt;/P&gt;
&lt;P&gt;As a result, the value sas read in is 82.5000000000 which is corresponding to the display cell value 82.5.&lt;/P&gt;
&lt;P&gt;While the actual value is 82.4678901235 if we change the format on excel (decimal=10).&lt;/P&gt;
&lt;P&gt;The above code is a part of the full program. The program&amp;nbsp; contains sql to connect database to extract data.&lt;/P&gt;
&lt;P&gt;Proc compare to compare two sas datasets which are read in the data from excel report and from database.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 15:16:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262477#M51251</guid>
      <dc:creator>wtien196838</dc:creator>
      <dc:date>2016-04-08T15:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to import excel values correctly into SAS dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262575#M51298</link>
      <description>&lt;P&gt;Hello William,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think, the problem is that generally&amp;nbsp;&lt;EM&gt;formatted&lt;/EM&gt;&amp;nbsp;values are sent through the DDE connection (SAS-formatted values to Excel and Excel-formatted values to SAS). So, the solution should be to let SAS instruct Excel (via DDE) to show all decimals in the relevant cells and only &lt;EM&gt;then&lt;/EM&gt; read the numbers. Please refer to section 5 ("Changing Cell Formats") on page 4 of &lt;A href="http://www.pharmasug.org/psug2002/bp2002/ad15.pdf" target="_blank"&gt;this paper&lt;/A&gt;&amp;nbsp;for a short data _null_ step to accomplish this.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 19:38:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262575#M51298</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-04-08T19:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to import excel values correctly into SAS dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262585#M51301</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/41038"&gt;@wtien196838﻿&lt;/a&gt;&amp;nbsp;Just to clarify, when you ran with Best32 informat it did not work?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 20:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-excel-values-correctly-into-SAS-dataset/m-p/262585#M51301</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-08T20:08:57Z</dc:date>
    </item>
  </channel>
</rss>

