<?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 do I deal with nonstandard worksheet names using the Libname XLXS engine to read mult worksh in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400777#M97160</link>
    <description>&lt;P&gt;I get the same error.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am going to have them change all of the worksheet names; however, I'd love to find a way to do this so we don't have to always change the worksheet name in the future.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;</description>
    <pubDate>Tue, 03 Oct 2017 20:05:42 GMT</pubDate>
    <dc:creator>mendezla</dc:creator>
    <dc:date>2017-10-03T20:05:42Z</dc:date>
    <item>
      <title>How do I deal with nonstandard worksheet names using the Libname XLXS engine to read mult worksheets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400745#M97155</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to utilize the Libname statement to read in worksheet names from an Excel workbook.&amp;nbsp; I am successful reading in the worksheet names; however, one worksheet name has a name that is does not comply with SAS data set naming conventions.&amp;nbsp; When the library is created, I can see the worksheet name (now a dataset name) but I cannot change it or delete it.&amp;nbsp; So, when I need to import the data using Proc Import, it will not work because of the data set name. (I am create a macro variable that reads in all of the datasets within the library, and I use that macro variable within a macro that uses Proc Import).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is libname statement (it's a fake one since I cannot divulge the actual Excel worksheet name):&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname PAIN XLSX "C:\Users\lmendez\Documents\XXXX\2017\Q2_PAIN\XXXX_Tracking_PAIN_2017Q2.xlsx";

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The worksheet name is something like PAIN_1(varname).&amp;nbsp; The parenthesis is what is causing the issue.&amp;nbsp; When the library is created the worksheet name appears just fine, but when I try to run proc import, it gives me an error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the proc import:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IMPORT OUT= PAIN.PAIN_1(VAR NAME)&lt;BR /&gt;&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;   DATAFILE = "C:\Users\lmendez\Documents\XXXX\2017\Q2_PAIN\XXXX_Tracking_PAIN_2017Q2.xlsx" DBMS = xlsx REPLACE; &lt;BR /&gt;   SHEET = "PAIN_1(VAR NAME)"; &lt;BR /&gt;   GETNAMES = YES; &lt;BR /&gt;RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And here is the error msg:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;71       PROC IMPORT OUT= PROC IMPORT OUT= cPAIN.PAIN_1(VAR NAME)
                                                       -----
                                                       22
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

NOTE: The SAS System stopped processing this step because of errors.
ERROR 22-7: Invalid option name VAR.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Some notes:&amp;nbsp; I'm using PC SAS 9.4 in Windows.&amp;nbsp; I HAVE to use Excel Workbooks as I am QCing them.&amp;nbsp; I don't have the luxury to change the worksheet name as there are about 324 workbooks that I have to read in, plus the client wants the name in Excel with the parenthesis.&amp;nbsp; I have tried to use Proc Data sets to change the name, delete the data set (so I could try to recreate it), etc. but I get an error stating:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: Deleting CPAIN1.'ZIP_SUBGRP_OXYCO(CRUSH RESIS)'n (memtype=DATA).
ERROR: PAIN.'PAIN_1(VAR NAME)'n.DATA cannot be deleted because files cannot be deleted from the PAIN library.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Any thoughts on how to workaround this issue are appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 19:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400745#M97155</guid>
      <dc:creator>mendezla</dc:creator>
      <dc:date>2017-10-03T19:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do I deal with nonstandard worksheet names using the Libname XLXS engine to read mult worksh</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400770#M97158</link>
      <description>&lt;P&gt;There are a couple of ways to deal with this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Try this way of creating a non-standard dataset name&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IMPORT OUT= 'PAIN.PAIN_1(VAR NAME)'n&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Provide a SAS-standard dataset name instead.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 19:54:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400770#M97158</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-10-03T19:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I deal with nonstandard worksheet names using the Libname XLXS engine to read mult worksh</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400773#M97159</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You don't need proc import after using libname. Copy the worksheets to a sas-base-library, then renaming should be possible. Depending on the number of files/sheets using proc import (as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;suggested)&amp;nbsp;can be the easier way.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 20:03:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400773#M97159</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2017-10-03T20:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I deal with nonstandard worksheet names using the Libname XLXS engine to read mult worksh</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400777#M97160</link>
      <description>&lt;P&gt;I get the same error.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am going to have them change all of the worksheet names; however, I'd love to find a way to do this so we don't have to always change the worksheet name in the future.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 20:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400777#M97160</guid>
      <dc:creator>mendezla</dc:creator>
      <dc:date>2017-10-03T20:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I deal with nonstandard worksheet names using the Libname XLXS engine to read mult worksh</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400779#M97161</link>
      <description>&lt;P&gt;This might be worth looking at:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi31/115-31.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi31/115-31.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 20:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400779#M97161</guid>
      <dc:creator>Norman21</dc:creator>
      <dc:date>2017-10-03T20:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I deal with nonstandard worksheet names using the Libname XLXS engine to read mult worksh</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400816#M97169</link>
      <description>&lt;P&gt;I'm not sure I understand how I don't need a proc import after the libname statement.&amp;nbsp; I need to load the data, and the libname statement only loads the structure of the data sets.&amp;nbsp; I&amp;nbsp;'m going to try to copy the data sets, although I'm still having a hard time conceptualizing that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll let you know if I can get that to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 21:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400816#M97169</guid>
      <dc:creator>mendezla</dc:creator>
      <dc:date>2017-10-03T21:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I deal with nonstandard worksheet names using the Libname XLXS engine to read mult worksh</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400823#M97170</link>
      <description>&lt;P&gt;Thank you for the reference.&amp;nbsp; I actually have Vince's paper, but he uses ODS and I had already coded all of my programs with macros using the libname xlsx engine.&amp;nbsp; Although, since I haven't been able to solve my problem, I may want to code it the way Vince illustrates it in his paper.&amp;nbsp; This will provide me the workaround I need for the non-standard SAS naming convention worksheet name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for providing the reference!&amp;nbsp; I appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 21:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400823#M97170</guid>
      <dc:creator>mendezla</dc:creator>
      <dc:date>2017-10-03T21:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: How do I deal with nonstandard worksheet names using the Libname XLXS engine to read mult worksh</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400833#M97171</link>
      <description>&lt;P&gt;Your current code is trying to read from and write to the same worksheet.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;What are you actually trying to do?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are trying to copy from one workbook to another workbook then why not just use PROC COPY? You can tell SAS it is ok to use some nonstandard strings for member names by setting the&amp;nbsp;VALIDMEMNAME option to EXTEND.&amp;nbsp; You can tell SAS it is ok to use non-standard variable names by setting VALIDVARNAME option to ANY. You can refer to non-standard names (variable names or member names) using name literals.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So perhaps you just want something like this?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dir=C:\Users\lmendez\Documents\XXXX\2017\Q2_PAIN;
options validmemname=extend ;
libname IN XLSX "&amp;amp;dir\workbook1.xlsx";
libname OUT XLSX "&amp;amp;dir\workbook2.xlsx";
proc copy inlib=in outlib=out ;
  select "PAIN_1(VAR NAME)"n ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Here is an example of creating a sheet with () in the name using XLSX libname engine.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dir=%sysfunc(pathname(work));
libname out xlsx "&amp;amp;dir/test1.xlsx";
options validmemname=extend ;
data out.'class(test1)'n ;
 set sashelp.class;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 23:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400833#M97171</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-10-03T23:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I deal with nonstandard worksheet names using the Libname XLXS engine to read mult worksh</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400857#M97176</link>
      <description>A libref, assigned by libname statement, can be seen as a shortcut to a location in which datasets are stored. The engine used in a libname statement empowers SAS to see an Excel-file as storage location, so that the worksheets can be used like normal datasets, but with some restrictions.</description>
      <pubDate>Wed, 04 Oct 2017 04:33:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-deal-with-nonstandard-worksheet-names-using-the-Libname/m-p/400857#M97176</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2017-10-04T04:33:29Z</dc:date>
    </item>
  </channel>
</rss>

