<?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: Importing sheets from excel *MACRO* in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Importing-sheets-from-excel-MACRO/m-p/404402#M98304</link>
    <description>&lt;P&gt;Yep, the problem was two sheets named with a space between two words!. ("Table 25" and "Table 26")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!!&lt;/P&gt;</description>
    <pubDate>Mon, 16 Oct 2017 08:27:43 GMT</pubDate>
    <dc:creator>jbs23</dc:creator>
    <dc:date>2017-10-16T08:27:43Z</dc:date>
    <item>
      <title>Importing sheets from excel *MACRO*</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-sheets-from-excel-MACRO/m-p/404382#M98296</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i ran this code for other excel and works perfectly.&amp;nbsp;&lt;SPAN&gt;The problem is im trying to do the same with other excel and have this problem on the log.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname MYLIB pcfiles type=excel path="I:\blabla\blabla\blablabla\blablabla.xlsx";


proc sql;
     create table TABLE1 
     as select *
     from dictionary.tables
     where libname="MYLIB";
quit;


proc sql;
     select MEMNAME
     into :NAMELIST separated by '*'
     from TABLE1;
quit;

proc sql;
     select count(MEMNAME)
     into :NUM
     from TABLE1;
quit;

%put &amp;amp;NAMELIST;
%put &amp;amp;NUM;



%macro MYLOOP;
     %do i=1 %to &amp;amp;NUM;
     %let NAME1=%scan(&amp;amp;NAMELIST,&amp;amp;i,*);
     %let NAME2=%substr(&amp;amp;NAME1,1,%length(&amp;amp;NAME1)-1);

     data &amp;amp;NAME2;
          set MYLIB."&amp;amp;NAME1"n;
			if missing(cats(of _all_)) then delete;
     run;
     %end;

%mend MYLOOP;

%MYLOOP&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;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;43         %macro MYLOOP;
44              %do i=1 %to &amp;amp;NUM;
45              %let NAME1=%scan(&amp;amp;NAMELIST,&amp;amp;i,*);
46              %let NAME2=%substr(&amp;amp;NAME1,1,%length(&amp;amp;NAME1)-1);
47         
48              data &amp;amp;NAME2;
49                   set MYLIB."&amp;amp;NAME1"n;
50         			if missing(cats(of _all_)) then delete;
51              run;
52              %end;
53         
54         %mend MYLOOP;
55         
56         %MYLOOP
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;ERROR: Literal contains unmatched quote.
ERROR: The macro MYLOOP will stop executing.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Why can this happen? how can i fix it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much in advance&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 07:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-sheets-from-excel-MACRO/m-p/404382#M98296</guid>
      <dc:creator>jbs23</dc:creator>
      <dc:date>2017-10-16T07:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Importing sheets from excel *MACRO*</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-sheets-from-excel-MACRO/m-p/404400#M98303</link>
      <description>&lt;P&gt;Know your data. Since Excel allows all kinds of crap as sheet names, you probably have a quote in there.&lt;/P&gt;
&lt;P&gt;Like Joe's Garage.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 08:12:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-sheets-from-excel-MACRO/m-p/404400#M98303</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-16T08:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Importing sheets from excel *MACRO*</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-sheets-from-excel-MACRO/m-p/404402#M98304</link>
      <description>&lt;P&gt;Yep, the problem was two sheets named with a space between two words!. ("Table 25" and "Table 26")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much!!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 08:27:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-sheets-from-excel-MACRO/m-p/404402#M98304</guid>
      <dc:creator>jbs23</dc:creator>
      <dc:date>2017-10-16T08:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Importing sheets from excel *MACRO*</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-sheets-from-excel-MACRO/m-p/404404#M98305</link>
      <description>&lt;P&gt;Why can you not just use proc copy to copy all the existing data from the libname to a new name?&amp;nbsp; SAS will automatically create valid SAS names for each of the datasets.&amp;nbsp; Alternatively you could use a data _null_ step, and call execute the code for each tab.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 09:01:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-sheets-from-excel-MACRO/m-p/404404#M98305</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-16T09:01:00Z</dc:date>
    </item>
  </channel>
</rss>

