<?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: Reading Excel Files by Selecting Certain Sheets in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175465#M45030</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;Thank you for your answer. I have about 1200 xlsx files. The code above works so well for csv files. I thought it would be great to tweak it so that SAS can read xlsx extension files as efficiently. I hope I was able to answer your question. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Jan 2015 22:04:48 GMT</pubDate>
    <dc:creator>finans_sas</dc:creator>
    <dc:date>2015-01-08T22:04:48Z</dc:date>
    <item>
      <title>Reading Excel Files by Selecting Certain Sheets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175463#M45028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a very large number of excel files that I need to put in SAS. My files are in XLSX extension. These files come with two sheets. So far I opened each xlsx document and save the sheet with the data as csv. Next, I use the following code (thanks to UCLA) to read these CSV files. Even though this process works, it takes a long time to open each xlsx and save it as csv. I would appreciate your help with modifying the code below so that it reads XLSX files but only the sheet called "Data Sheet" (Note: the changes that I made are in green).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; dirname = C:\sasfiles;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;filename&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; DIRLIST &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;pipe&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"dir /B &amp;amp;dirname\*.&lt;SPAN style="color: #00ff00;"&gt;xlsx&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; dirlist ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; fname $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;256&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; dirlist &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=reclen ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; fname &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;$varying256.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; reclen ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; = dirlist;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; all_excel (drop=fname);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; myfilename $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;50&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; dirlist;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; filepath = &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;"&amp;amp;dirname\"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;||fname;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; dummy &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;filevar&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; = filepath &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=reclen &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=done &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;missover&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;firstobs&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;dlm&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: #00ff00; background: none repeat scroll 0% 0% white;"&gt;'09'x&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;dsd&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;lrecl&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;32767&lt;/STRONG&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(not done);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myfilename = filepath;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt; input var1 var2 var3;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;output;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 21:41:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175463#M45028</guid>
      <dc:creator>finans_sas</dc:creator>
      <dc:date>2015-01-08T21:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Excel Files by Selecting Certain Sheets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175464#M45029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why can't you read the Excel file directly? Do you not have access to SAS/ACCESS? Or is there some specific format in your Excel file that SAS can't read in properly?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 21:57:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175464#M45029</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-08T21:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Excel Files by Selecting Certain Sheets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175465#M45030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;Thank you for your answer. I have about 1200 xlsx files. The code above works so well for csv files. I thought it would be great to tweak it so that SAS can read xlsx extension files as efficiently. I hope I was able to answer your question. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 22:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175465#M45030</guid>
      <dc:creator>finans_sas</dc:creator>
      <dc:date>2015-01-08T22:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Excel Files by Selecting Certain Sheets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175466#M45031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, you can't read all excel files in the same way unfortunately. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will need to either batch convert all CSV to XLSX or batch import. Either way, if using SAS a macro is a decent way to go. &lt;/P&gt;&lt;P&gt;I'm assuming all the files have the same structure though. Is the sheet name important to keep as well?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a often asked question so there are several solutions on here already that search will turn up. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 22:17:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175466#M45031</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-01-08T22:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Excel Files by Selecting Certain Sheets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175467#M45032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Reeza. I just wrote a small macro that does the job. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 23:38:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175467#M45032</guid>
      <dc:creator>finans_sas</dc:creator>
      <dc:date>2015-01-08T23:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Excel Files by Selecting Certain Sheets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175468#M45033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;would you please provide the batch code...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2015 12:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175468#M45033</guid>
      <dc:creator>Rahul_SAS</dc:creator>
      <dc:date>2015-01-15T12:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Excel Files by Selecting Certain Sheets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175469#M45034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you use libname statement &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname x excel '.........xls';&lt;/P&gt;&lt;P&gt;libname x xlsx '..........xls'&lt;/P&gt;&lt;P&gt;libname x excelcs '..........xls'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then directly copy it frim x library.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data x;&lt;/P&gt;&lt;P&gt;set x.'&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Data Sheet$&lt;/SPAN&gt;'n;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2015 12:52:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175469#M45034</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-15T12:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Reading Excel Files by Selecting Certain Sheets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175470#M45035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanx keshan &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jan 2015 05:16:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Reading-Excel-Files-by-Selecting-Certain-Sheets/m-p/175470#M45035</guid>
      <dc:creator>Rahul_SAS</dc:creator>
      <dc:date>2015-01-16T05:16:42Z</dc:date>
    </item>
  </channel>
</rss>

