<?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: Convert all XLS files in directory to CSV using SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-XLS-files-in-directory-to-CSV-using-SAS/m-p/875496#M345920</link>
    <description>&lt;P&gt;I think it's better done using a Microsoft based tool for Batch converting all excel files to CSV in a folder or library rather than SAS as a primary tool for this purpose. Please see if the following link helps -&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.extendoffice.com/documents/excel/5537-excel-batch-convert-to-csv.html#a1" target="_blank"&gt;How to batch convert multiple Excel files to CSV files in Excel? (extendoffice.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 May 2023 16:50:10 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2023-05-12T16:50:10Z</dc:date>
    <item>
      <title>Convert all XLS files in directory to CSV using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-XLS-files-in-directory-to-CSV-using-SAS/m-p/875494#M345918</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just looking for a quick and dirty macro which can convert all XLS files in a given directory to CSV.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;Jenna&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 16:29:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-XLS-files-in-directory-to-CSV-using-SAS/m-p/875494#M345918</guid>
      <dc:creator>Walternate</dc:creator>
      <dc:date>2023-05-12T16:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all XLS files in directory to CSV using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-XLS-files-in-directory-to-CSV-using-SAS/m-p/875496#M345920</link>
      <description>&lt;P&gt;I think it's better done using a Microsoft based tool for Batch converting all excel files to CSV in a folder or library rather than SAS as a primary tool for this purpose. Please see if the following link helps -&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.extendoffice.com/documents/excel/5537-excel-batch-convert-to-csv.html#a1" target="_blank"&gt;How to batch convert multiple Excel files to CSV files in Excel? (extendoffice.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 16:50:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-XLS-files-in-directory-to-CSV-using-SAS/m-p/875496#M345920</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2023-05-12T16:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Convert all XLS files in directory to CSV using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-all-XLS-files-in-directory-to-CSV-using-SAS/m-p/875503#M345924</link>
      <description>&lt;P&gt;One way to do this is you can try &lt;STRONG&gt;filename&lt;/STRONG&gt; statement with &lt;U&gt;windows command&lt;/U&gt; to read all xls files in the directory, then save file name and path in sas dataset, to import and export them in the following data step using &lt;STRONG&gt;call execute&lt;/STRONG&gt; routine.&amp;nbsp;&lt;BR /&gt;The example code would be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename xlslist pipe 'dir /b /s "C:\myfolder\*.xls" ';
data temp;
   infile xlslist truncover;
   input filepath $200.;
   filename= scan(filepath, -1, '\');
proc print;run;

data _null_;
	set temp end=eof;
	call execute("proc import datafile="||quote(filepath)||' '||"out="||scan(filename,1, '.')||' '||"dbms="||scan(filename, 2, '.')||"replace; run;");
	if eof then do;
		call execute("proc export outfile="||quote(filepath)||' '||"data=work."||scan(filename,1, '.')||' '||"dbms=csv replace; run;");
	end; 
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;PS: I used proc import, and call execute routine is something I rarely use, so there could be more efficient ways to write this code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 17:55:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-all-XLS-files-in-directory-to-CSV-using-SAS/m-p/875503#M345924</guid>
      <dc:creator>A_Kh</dc:creator>
      <dc:date>2023-05-12T17:55:47Z</dc:date>
    </item>
  </channel>
</rss>

