<?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: Reference Excel named range on a specific sheet? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Reference-Excel-named-range-on-a-specific-sheet/m-p/551855#M9062</link>
    <description>&lt;P&gt;Start by checking what SAS is seeing, I would swithc Excel to XLSX as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname R1600f xlsx "Z:\Information Analysis &amp;amp; Distribution\Performance Management\Reporting\Renal\Phase 2 Reporting\R1600 - Dialysis Treatments\WORKING\R1600 - MONTHLY2.xlsx";

proc datasets lib=R1600f;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This should tell you all the names in the files.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you absolutely cannot get this working, I recommend switching to PCFILES instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname R1600f pcfiles path ="Z:\Information Analysis &amp;amp; Distribution\Performance Management\Reporting\Renal\Phase 2 Reporting\R1600 - Dialysis Treatments\WORKING\R1600 - MONTHLY2.xlsx";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Run the same thing as above, find the data set name, drop it and then reexport your data. I've done this using PCFILES many a time, so 99% sure that should work fine. I've had issues with XLSX&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/98752"&gt;@x2008kyr&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi there, I am trying to automate a report by exporting data into an excel template with multiple sheets (one for each month) and a number of different already defined named ranges. I am having trouble referencing the named range on a specific sheet when trying to output the data to it. I get the following error...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: Error attempting to CREATE a DBMS table. ERROR: Execute: 'April$APR_date' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume I am getting the error because of the '$' used to specify which sheet I am referring to... SAS CODE:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*create date generated;
data date;
	v1="AS OF:";
	date=today()-1;
	format date date9.;
run;

*import template;
libname R1600f excel "Z:\Information Analysis &amp;amp; Distribution\Performance Management\Reporting\Renal\Phase 2 Reporting\R1600 - Dialysis Treatments\WORKING\R1600 - MONTHLY2.xlsx";

*delete named ranges;
proc datasets library=R1600f  nolist;
	delete 'April$APR_date'n;
run;

data R1600f.'April$APR_date'n;
	set date;
run;

*disconnect from template;
libname R1600f clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have verified that the named range in SAS is April$APR_date which corresponds to the&amp;nbsp;range name APR_date&amp;nbsp;on the April worksheet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Apr 2019 18:42:20 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-04-17T18:42:20Z</dc:date>
    <item>
      <title>Reference Excel named range on a specific sheet?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Reference-Excel-named-range-on-a-specific-sheet/m-p/551848#M9060</link>
      <description>&lt;P&gt;Hi there, I am trying to automate a report by exporting data into an excel template with multiple sheets (one for each month) and a number of different already defined named ranges. I am having trouble referencing the named range on a specific sheet when trying to output the data to it. I get the following error...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Error attempting to CREATE a DBMS table. ERROR: Execute: 'April$APR_date' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume I am getting the error because of the '$' used to specify which sheet I am referring to... SAS CODE:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*create date generated;
data date;
	v1="AS OF:";
	date=today()-1;
	format date date9.;
run;

*import template;
libname R1600f excel "Z:\Information Analysis &amp;amp; Distribution\Performance Management\Reporting\Renal\Phase 2 Reporting\R1600 - Dialysis Treatments\WORKING\R1600 - MONTHLY2.xlsx";

*delete named ranges;
proc datasets library=R1600f  nolist;
	delete 'April$APR_date'n;
run;

data R1600f.'April$APR_date'n;
	set date;
run;

*disconnect from template;
libname R1600f clear;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have verified that the named range in SAS is April$APR_date which corresponds to the&amp;nbsp;range name APR_date&amp;nbsp;on the April worksheet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 18:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Reference-Excel-named-range-on-a-specific-sheet/m-p/551848#M9060</guid>
      <dc:creator>x2008kyr</dc:creator>
      <dc:date>2019-04-17T18:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reference Excel named range on a specific sheet?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Reference-Excel-named-range-on-a-specific-sheet/m-p/551855#M9062</link>
      <description>&lt;P&gt;Start by checking what SAS is seeing, I would swithc Excel to XLSX as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname R1600f xlsx "Z:\Information Analysis &amp;amp; Distribution\Performance Management\Reporting\Renal\Phase 2 Reporting\R1600 - Dialysis Treatments\WORKING\R1600 - MONTHLY2.xlsx";

proc datasets lib=R1600f;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This should tell you all the names in the files.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you absolutely cannot get this working, I recommend switching to PCFILES instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname R1600f pcfiles path ="Z:\Information Analysis &amp;amp; Distribution\Performance Management\Reporting\Renal\Phase 2 Reporting\R1600 - Dialysis Treatments\WORKING\R1600 - MONTHLY2.xlsx";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Run the same thing as above, find the data set name, drop it and then reexport your data. I've done this using PCFILES many a time, so 99% sure that should work fine. I've had issues with XLSX&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/98752"&gt;@x2008kyr&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi there, I am trying to automate a report by exporting data into an excel template with multiple sheets (one for each month) and a number of different already defined named ranges. I am having trouble referencing the named range on a specific sheet when trying to output the data to it. I get the following error...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: Error attempting to CREATE a DBMS table. ERROR: Execute: 'April$APR_date' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I assume I am getting the error because of the '$' used to specify which sheet I am referring to... SAS CODE:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*create date generated;
data date;
	v1="AS OF:";
	date=today()-1;
	format date date9.;
run;

*import template;
libname R1600f excel "Z:\Information Analysis &amp;amp; Distribution\Performance Management\Reporting\Renal\Phase 2 Reporting\R1600 - Dialysis Treatments\WORKING\R1600 - MONTHLY2.xlsx";

*delete named ranges;
proc datasets library=R1600f  nolist;
	delete 'April$APR_date'n;
run;

data R1600f.'April$APR_date'n;
	set date;
run;

*disconnect from template;
libname R1600f clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have verified that the named range in SAS is April$APR_date which corresponds to the&amp;nbsp;range name APR_date&amp;nbsp;on the April worksheet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 18:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Reference-Excel-named-range-on-a-specific-sheet/m-p/551855#M9062</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-17T18:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Reference Excel named range on a specific sheet?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Reference-Excel-named-range-on-a-specific-sheet/m-p/551872#M9064</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the prompt reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I realized what my issue was. I didn't realize that when the named ranges were created that they someone defaulted to a scope that was worksheet specific and not the global scope "workbook". Apparently SAS will only recognize named ranges that are defined with a global scope in excel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jessy&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 19:36:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Reference-Excel-named-range-on-a-specific-sheet/m-p/551872#M9064</guid>
      <dc:creator>x2008kyr</dc:creator>
      <dc:date>2019-04-17T19:36:35Z</dc:date>
    </item>
  </channel>
</rss>

