<?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 Losing named ranges when reading COPY of excel file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309749#M66739</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a weird situation. &amp;nbsp;I have an excel file that has named ranges. &amp;nbsp;When I read the original using...&lt;/P&gt;
&lt;P&gt;libname spec excel "&amp;lt;original location&amp;gt;\&amp;amp;currentspec" mixed = yes access=readonly;&lt;/P&gt;
&lt;P&gt;...I can see the named ranges in the SPEC libname.&lt;/P&gt;
&lt;P&gt;But when I copy the file with...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%sysexec copy "&amp;lt;original location&amp;gt;\&amp;amp;currentspec"&amp;nbsp;"&amp;lt;new location&amp;gt;\&amp;amp;currentspec";&lt;/P&gt;
&lt;P&gt;...I can see the ranges when I open the copy in Excel but can't see them when I read the file with the same libname statement as above. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;libname spec excel "&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;new location&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;\&amp;amp;currentspec" mixed = yes access=readonly;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thoughts?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Nov 2016 15:25:20 GMT</pubDate>
    <dc:creator>evp000</dc:creator>
    <dc:date>2016-11-07T15:25:20Z</dc:date>
    <item>
      <title>Losing named ranges when reading COPY of excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309749#M66739</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a weird situation. &amp;nbsp;I have an excel file that has named ranges. &amp;nbsp;When I read the original using...&lt;/P&gt;
&lt;P&gt;libname spec excel "&amp;lt;original location&amp;gt;\&amp;amp;currentspec" mixed = yes access=readonly;&lt;/P&gt;
&lt;P&gt;...I can see the named ranges in the SPEC libname.&lt;/P&gt;
&lt;P&gt;But when I copy the file with...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%sysexec copy "&amp;lt;original location&amp;gt;\&amp;amp;currentspec"&amp;nbsp;"&amp;lt;new location&amp;gt;\&amp;amp;currentspec";&lt;/P&gt;
&lt;P&gt;...I can see the ranges when I open the copy in Excel but can't see them when I read the file with the same libname statement as above. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;libname spec excel "&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;new location&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;\&amp;amp;currentspec" mixed = yes access=readonly;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thoughts?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 15:25:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309749#M66739</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2016-11-07T15:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Losing named ranges when reading COPY of excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309751#M66740</link>
      <description>&lt;P&gt;What its likely to be (and I cant check), is that when you define ranges in Excel, it puts extra information in, for instance a range could be defined as:&lt;/P&gt;
&lt;P&gt;Range("A1:A2")&lt;/P&gt;
&lt;P&gt;Or more accurately:&lt;/P&gt;
&lt;P&gt;Range("Sheet1!A1:A2")&lt;/P&gt;
&lt;P&gt;Or more accurately:&lt;/P&gt;
&lt;P&gt;Range("MyExcelFile$Sheet1!A1:A2")&lt;/P&gt;
&lt;P&gt;etc.&lt;/P&gt;
&lt;P&gt;What i suspect is happening behind the scenes is that the range has this file information on it, and when you make a copy - the filename would not match, hence the range is no longer found. &amp;nbsp;Tray copying the file to another path, and make sure the filename matches exactly, that may fix it. &amp;nbsp;Personally however, as always, I would just dump the data to CSV. &amp;nbsp;Any reason why you need to copy the file in the first place?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 15:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309751#M66740</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-11-07T15:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Losing named ranges when reading COPY of excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309779#M66747</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thanks for your input. &amp;nbsp;The name of the file hasn't changed. &amp;nbsp;It's exactly the same. &amp;nbsp;And the copy has the ranges in it. &amp;nbsp;I can see them when I open the file in Excel. &amp;nbsp;I just don't have them in SAS. &amp;nbsp;I tried copying manually&amp;nbsp;and I have the same problem. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;m.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 17:26:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309779#M66747</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2016-11-07T17:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Losing named ranges when reading COPY of excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309785#M66750</link>
      <description>&lt;P&gt;Can you just use the XLSX engine instead of the EXCEL engine? &amp;nbsp;Does that see the named ranges? &amp;nbsp;Perhaps taking actual EXCEL out of the process will make it work better.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure how you would confirm it, but I suspect it is releated to how Office stores both formulas and the current value of the formula. &amp;nbsp;So it might store the range definition in symbolic form and also as the resulting detailed definition form. &amp;nbsp;And SAS might be getting the second version that is trying to refer back to the original file location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another thing to watch out for is that Excel does not like to open two files with the same name (even when they come from different directory paths). &amp;nbsp;Perhaps your instance of Excel is getting confused by this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 17:38:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309785#M66750</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-11-07T17:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Losing named ranges when reading COPY of excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309787#M66751</link>
      <description>&lt;P&gt;Thanks, I'll try xlsx when I get a chance. &amp;nbsp;Under normal circumstances, I never touch&amp;nbsp;the original, so I don't open both of them.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 17:44:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309787#M66751</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2016-11-07T17:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Losing named ranges when reading COPY of excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309830#M66765</link>
      <description>&lt;P&gt;I don't have 9.4 yet so no XLSX libname engine. &amp;nbsp; &amp;nbsp; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 19:37:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309830#M66765</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2016-11-07T19:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: Losing named ranges when reading COPY of excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309881#M66776</link>
      <description>&lt;P&gt;The whole point of this named range business was to read all the xlsx spreadsheets using the 2nd line for var names rather than the first. &amp;nbsp;I'm starting to think that the whole process is way too cumbersome, and rather than having the data&amp;nbsp;managers run a macro that defines the named ranges every time they edit the file, it's a lot easier to just read from A2 to Z5000 (or some arbitrarily large number), since SAS only reads the rows and columns that are populated anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So all this becomes a moot point. &amp;nbsp;Thanks for the input though. &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 21:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309881#M66776</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2016-11-07T21:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Losing named ranges when reading COPY of excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309993#M66810</link>
      <description>&lt;P&gt;Well as I noted above, if the filename hasn't changed then you must have moved that file to another location. &amp;nbsp;You cannot have two files with exactly the same path/filename - hence some of the information on that has changed. &amp;nbsp;This is likely why.&lt;/P&gt;
&lt;P&gt;Simply put Excel is possibly the worst medium you can use for data transfer, I cannot stress to you how bad it is. &amp;nbsp;Use any proper data transfer format and your life will be so much easier - CSV, XML, dataset, delimted etc. &amp;nbsp;I know, your response is going to be, but we "have" to use Excel, generally I hate that word have to. &amp;nbsp;Even then however you could save the data to Excel - write a macro to do it if you have to, just get away from the horribly unstructured/uncontrolled environment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 09:33:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Losing-named-ranges-when-reading-COPY-of-excel-file/m-p/309993#M66810</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-11-08T09:33:55Z</dc:date>
    </item>
  </channel>
</rss>

