<?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: Writing to Excel named range - code runs successfully but Excel sheet not updated in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645780#M193076</link>
    <description>Hi, the range is &amp;amp;next_value._Rate, so is deleted in proc datasets, before being written afresh in the data step.</description>
    <pubDate>Thu, 07 May 2020 05:41:05 GMT</pubDate>
    <dc:creator>robulon</dc:creator>
    <dc:date>2020-05-07T05:41:05Z</dc:date>
    <item>
      <title>Writing to Excel named range - code runs successfully but Excel sheet not updated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645555#M193007</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been using the libname Excel method of writing to a named range in an Excel sheet for a few monbths, since a colleague at work introduced me to the technique and have found it very useful. I am having issues with it at the moment though in as much as for a particular sheet, when I run the code, the log tells me the code has run successfully but the Excel sheet has not been updated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have run the code a couple of times today and it has worked (the Excel file shows as having been modified at 11:08 today) but when I have run it again since, it is not updating. I have checked that it was trying to write to the correct location (which I knew it was) by running the code with the Excel file open and the code errors, and I have checked that the named ranges still exist within the file (which they do) so I just don't know what else it could be.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output datasets have three variables in, a date, a character variable and a number (in percent format) - example attached.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Example.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39096i773CF03D723EC21B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Example.PNG" alt="Example.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I am using is below: -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let xlpath= ##\Covid\Arrears_Summary_Covid_&amp;amp;covid..xlsx;&lt;BR /&gt;libname xl Excel "&amp;amp;xlpath.";&lt;/P&gt;&lt;P&gt;proc datasets lib=xl nolist;&lt;BR /&gt;delete &amp;amp;next_value._Rate;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;data xl.&amp;amp;next_value._Rate;&lt;BR /&gt;set &amp;amp;next_value._totals_2_covid_&amp;amp;covid.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;libname xl clear;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the log shows this: -&lt;/P&gt;&lt;P&gt;NOTE: Libref XL was successfully assigned as follows:&lt;BR /&gt;Engine: EXCEL&lt;BR /&gt;Physical Name: ##\Covid\Arrears_Summary_Covid_1.xlsx&lt;/P&gt;&lt;P&gt;NOTE: Deleting XL.Improve_Rate (memtype=DATA).&lt;BR /&gt;NOTE: PROCEDURE DATASETS used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;11 The SAS System 10:39 Wednesday, May 6, 2020&lt;/P&gt;&lt;P&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.&lt;BR /&gt;NOTE: There were 52 observations read from the data set WORK.IMPROVE_TOTALS_2_COVID_1.&lt;BR /&gt;NOTE: The data set XL.Improve_Rate has 52 observations and 3 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;NOTE: Libref XL has been deassigned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any thoughts as to what could be causing this, only it's a huge frustration for me at the moment. Nothing of any consequence has been changed in the code between runnings so I'm really at a loss as to why it worked previously but not now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 11:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645555#M193007</guid>
      <dc:creator>robulon</dc:creator>
      <dc:date>2020-05-06T11:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Excel named range - code runs successfully but Excel sheet not updated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645628#M193020</link>
      <description>&lt;P&gt;What happens if you just run the delete portion?&lt;/P&gt;
&lt;P&gt;Please post the log as well.&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 15:19:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645628#M193020</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-06T15:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Excel named range - code runs successfully but Excel sheet not updated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645630#M193021</link>
      <description>&lt;P&gt;Where are you indicating the named ranges?&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 15:22:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645630#M193021</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-06T15:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Excel named range - code runs successfully but Excel sheet not updated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645637#M193023</link>
      <description>There's one issue I recall running into when using this methodology - if your data is larger than the named range it won't export it, nothing happens. Your named range must be larger than the data set space needed, ie your number of rows and columns needs to be number of observations +1 and number of variables, respectively. If you test it step by step as I indicated in my last post you'll be able to see if the program is running at all or if this is the issue pretty quickly. &lt;BR /&gt;</description>
      <pubDate>Wed, 06 May 2020 15:40:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645637#M193023</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-06T15:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Excel named range - code runs successfully but Excel sheet not updated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645779#M193075</link>
      <description>Thanks Reeza, I'll have a look into this. I'm not sure that what you're saying about the size of the data is quit correct for a couple of reasons. Firstly, I use this approach in a number of other programs which add a new observation each day so the size of the data set increases by one each time and they all work. The other reason being that my understanding is that by deleting the range using proc datasets, the initial size of it shouldn't come into play. I will have a look at running the program in its individual parts and see if that tells me anything - thanks.</description>
      <pubDate>Thu, 07 May 2020 05:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645779#M193075</guid>
      <dc:creator>robulon</dc:creator>
      <dc:date>2020-05-07T05:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Excel named range - code runs successfully but Excel sheet not updated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645780#M193076</link>
      <description>Hi, the range is &amp;amp;next_value._Rate, so is deleted in proc datasets, before being written afresh in the data step.</description>
      <pubDate>Thu, 07 May 2020 05:41:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645780#M193076</guid>
      <dc:creator>robulon</dc:creator>
      <dc:date>2020-05-07T05:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Excel named range - code runs successfully but Excel sheet not updated</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645927#M193145</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62592"&gt;@robulon&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;by deleting the range using proc datasets, the initial size of it shouldn't come into play.&amp;nbsp;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You do not delete the range, it deletes the data in the range but the named range still exists. You can check this when you run your code in sections.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2020 15:48:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Writing-to-Excel-named-range-code-runs-successfully-but-Excel/m-p/645927#M193145</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-07T15:48:26Z</dc:date>
    </item>
  </channel>
</rss>

