<?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: PROC IMPORT reading old data from Excel Sheet - Even though formula already updated the values in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-reading-old-data-from-Excel-Sheet-Even-though/m-p/579801#M34429</link>
    <description>&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;Since the code was handed over from someone else, we were trying to see if there is a way to make this work without have to transfer all the calculations to SAS that. However, that is what we ended up doing - moving the calculations to SAS.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2019 05:58:16 GMT</pubDate>
    <dc:creator>AngSAS</dc:creator>
    <dc:date>2019-08-08T05:58:16Z</dc:date>
    <item>
      <title>PROC IMPORT reading old data from Excel Sheet - Even though formula already updated the values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-reading-old-data-from-Excel-Sheet-Even-though/m-p/577965#M34349</link>
      <description>&lt;P&gt;Hi SAS Users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have come across an issue where, if I read (proc import) a sheet from excel file it is reading old values from columns which contains formula - even though the values have been updated because of the source cells being updated with new values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;In a sheet named 'TestSheet' in file 'testsheet.xlsx' I have following values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;DataHere&lt;/TD&gt;&lt;TD&gt;FormulaHere&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where first column is in a range called 'DataRange' and the second column is in a range called 'FormulaRange'.&lt;/P&gt;&lt;P&gt;First column has numerical values (in this case 10 and 9) and second column has formula that adds 1 to value in corresponding A column i.e. formula in B2 is A2+1 and in B3 is B2+1, resulting in values 11 and 10 respectively.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run proc import now:&lt;/P&gt;&lt;PRE&gt;proc import 

datafile= "\\&amp;lt;filepath&amp;gt;\testsheet.xlsx"
out= TestDataSet
dbms=xlsx
replace;
sheet="TestSheet";
GETNAMES = YES;
run;&lt;/PRE&gt;&lt;P&gt;I get values as expected.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DataHere&amp;nbsp; FormulaHere&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;11&lt;/P&gt;&lt;P&gt;&amp;nbsp; 9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, if I run following script to update the values in column A to 1 and 2 using SAS dataset 'testdata':&lt;/P&gt;&lt;PRE&gt;data testdata;
input DataHere;
datalines;
1
2
; 

libname xl Excel "\\&amp;lt;filepath&amp;gt;\testsheet.xlsx";

proc sql;
drop table xl.DataRange;
create table xl.DataRange as
select * from testdata;
quit;

libname xl clear;&lt;/PRE&gt;&lt;P&gt;Then it success fully updates the values in column A; which should have updated the values in column B as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I run proc import again to read data from the sheet:&lt;/P&gt;&lt;PRE&gt;proc import 

datafile= "\\&amp;lt;filepath&amp;gt;\testsheet.xlsx"
out= TestDataSet
dbms=xlsx
replace;
sheet="TestSheet";
GETNAMES = YES;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS only gets updated values from column A but not column B (gets old values):&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DataHere&amp;nbsp; FormulaHere&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#FF0000"&gt;11&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#FF0000"&gt;10&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Even though when I open the excel spreadsheet I can see the values updated in column B as well:&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DataHere&amp;nbsp; FormulaHere&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Is there a way to get SAS to read the updated Data?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 07:02:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-reading-old-data-from-Excel-Sheet-Even-though/m-p/577965#M34349</guid>
      <dc:creator>AngSAS</dc:creator>
      <dc:date>2019-07-31T07:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT reading old data from Excel Sheet - Even though formula already updated the values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-reading-old-data-from-Excel-Sheet-Even-though/m-p/577969#M34350</link>
      <description>&lt;P&gt;The evaluation of formulas is a function of the Excel &lt;EM&gt;software&lt;/EM&gt;. SAS only updates Excel &lt;EM&gt;data&lt;/EM&gt;, but does not emulate the behaviour of the Excel software in any way. To update the results of Excel formulas, you have to load the workbook in Excel and make it refresh the spreadsheets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Frankly, when you have SAS at hand, why do you still pack logic into Excel? Do your calculations in SAS, and load the end results into Excel; with ODS Excel, you can even do all the pretty formatting.&lt;/P&gt;
&lt;P&gt;Avoid multi-platforming of your logic as much as you can.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 07:25:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-reading-old-data-from-Excel-Sheet-Even-though/m-p/577969#M34350</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-31T07:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT reading old data from Excel Sheet - Even though formula already updated the values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-reading-old-data-from-Excel-Sheet-Even-though/m-p/579801#M34429</link>
      <description>&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;Since the code was handed over from someone else, we were trying to see if there is a way to make this work without have to transfer all the calculations to SAS that. However, that is what we ended up doing - moving the calculations to SAS.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 05:58:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/PROC-IMPORT-reading-old-data-from-Excel-Sheet-Even-though/m-p/579801#M34429</guid>
      <dc:creator>AngSAS</dc:creator>
      <dc:date>2019-08-08T05:58:16Z</dc:date>
    </item>
  </channel>
</rss>

