<?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 Combining multiple Excel files while maintaining their identities in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181089#M46129</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 want to ask something that I've been struggling with it for the last day or so. I've seen other posts similar to mine on this forum but for some reason I haven't been able to utilize them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alright, so I have multiple CSV files (with identical variables) that I want to merge while maintaining their identity. I should add, I only want to merge some of the files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example will make it clear. Suppose I have the following files;&lt;/P&gt;&lt;P&gt;2014_1.csv&lt;/P&gt;&lt;P&gt;2014_2.csv&lt;/P&gt;&lt;P&gt;2014_3.csv&lt;/P&gt;&lt;P&gt;aa_2014_1.csv&lt;/P&gt;&lt;P&gt;aa_2014_2.csv&lt;/P&gt;&lt;P&gt;aa_2014_3.csv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;When I merge (say the top 3 files), I want to have another variable with the original file name attached to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the final table would look like the following;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Var1 Var2 Period&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 323&amp;nbsp;&amp;nbsp; 2014_1&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 432&amp;nbsp;&amp;nbsp; 2014_1&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 432&amp;nbsp;&amp;nbsp; 2014_2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;Can anyone help with this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Sep 2014 00:37:22 GMT</pubDate>
    <dc:creator>erickbernard</dc:creator>
    <dc:date>2014-09-01T00:37:22Z</dc:date>
    <item>
      <title>Combining multiple Excel files while maintaining their identities</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181089#M46129</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 want to ask something that I've been struggling with it for the last day or so. I've seen other posts similar to mine on this forum but for some reason I haven't been able to utilize them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alright, so I have multiple CSV files (with identical variables) that I want to merge while maintaining their identity. I should add, I only want to merge some of the files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example will make it clear. Suppose I have the following files;&lt;/P&gt;&lt;P&gt;2014_1.csv&lt;/P&gt;&lt;P&gt;2014_2.csv&lt;/P&gt;&lt;P&gt;2014_3.csv&lt;/P&gt;&lt;P&gt;aa_2014_1.csv&lt;/P&gt;&lt;P&gt;aa_2014_2.csv&lt;/P&gt;&lt;P&gt;aa_2014_3.csv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;When I merge (say the top 3 files), I want to have another variable with the original file name attached to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the final table would look like the following;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Var1 Var2 Period&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 323&amp;nbsp;&amp;nbsp; 2014_1&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 432&amp;nbsp;&amp;nbsp; 2014_1&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 432&amp;nbsp;&amp;nbsp; 2014_2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;Can anyone help with this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Sep 2014 00:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181089#M46129</guid>
      <dc:creator>erickbernard</dc:creator>
      <dc:date>2014-09-01T00:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple Excel files while maintaining their identities</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181090#M46130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1) You could use Powershell to add ",&amp;lt;filename&amp;gt;" (end of line) or "&amp;lt;filename&amp;gt;," (beginning of line) to your files, while merging them into a single combined file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) You could write a VBA module to add this column as it reads multiple files into a single worksheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) You could easily do this using Perl or Python or .Net or ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) You could import multiple CSV files into SAS using an aggregated fileref, use the FILEVAR option of the INFILE statement to capture the current filename, parse the full path to get the basename, and write back out the merged CSV file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is your *final* "landing zone" for your data?&amp;nbsp; Is it a merged CSV file?&amp;nbsp; A SAS dataset?&amp;nbsp; Excel?&amp;nbsp; Another database?&amp;nbsp; Depending on your answer, you may be able to skip the merged CSV file part.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Sep 2014 00:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181090#M46130</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2014-09-01T00:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple Excel files while maintaining their identities</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181091#M46131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your reply. The data comes in CSV format and all the processing/analysis will be done in SAS. I have a strong preference to keep all processing/analysis in a single platform to maintain version control and easy reproducibility. So I'm planning to keep the CSV files as is.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Sep 2014 01:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181091#M46131</guid>
      <dc:creator>erickbernard</dc:creator>
      <dc:date>2014-09-01T01:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple Excel files while maintaining their identities</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181092#M46132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've managed to write the code in R, and I guess wil stick with that. I'm not sure about the etiquette of posting code for other packages, so I'll wait for a while to see if anyone objects me posting R code here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Sep 2014 04:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181092#M46132</guid>
      <dc:creator>erickbernard</dc:creator>
      <dc:date>2014-09-01T04:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple Excel files while maintaining their identities</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181093#M46133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="background: white; font-size: 10pt; background-color: #ffffff; font-family: Helvetica, sans-serif;"&gt;So I'm planning to keep the CSV files as is.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;"&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;I'm not sure what this means???&amp;nbsp; Are you planning to keep your source CSV files as is, your target CSV files as is (which doesn't make sense, since they don't exist yet), or your CSV code generation program as is?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;You say you "have a strong preference to keep all processing/analysis in a single platform", yet ask a question in a SAS forum, then say you've got the code in R?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;Anyway, given your problem statement above, and with lots of assumptions, here is what I think you want to do, using SAS:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* create some dummy CSV files. ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* assumption: the files have the same structure, just different data ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;export&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=sashelp.stocks (where=(stock=&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"IBM"&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;)) file=&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"c:\temp\_ibm.csv"&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;dbms&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=csv;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;export&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=sashelp.stocks (where=(stock=&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"Intel"&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;)) file=&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"c:\temp\_intel.csv"&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;dbms&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=csv;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;proc&lt;/STRONG&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;export&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=sashelp.stocks (where=(stock=&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"Microsoft"&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;)) file=&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"c:\temp\_microsoft.csv"&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;dbms&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=csv;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* merge (append) the CSV files, setting the source of the file as a variable ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;filename&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; csvs &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"c:\temp\_*.csv"&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* note the wildcard in the filename statement ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 11.0pt; font-family: 'SAS Monospace';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; fullpath $&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;200&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; source $&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;20&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;infile&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; csvs &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;filename&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=fullpath &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;eov&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=eov &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;dsd&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;dlm&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;","&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* skip the header record on the first row of each file ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; @@; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* input and hold the record pointer, used to set eov ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; _n_=&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; or eov &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* eov is not set on _n_=1 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; eov=&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* need to reset eov, SAS doesn't do this automatically ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* release the record pointer for the next read ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;delete&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* throw away the header record ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;else&lt;/SPAN&gt; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; stock $ date open high low close volume adjClose;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* parse the fullpath to get just the source basename ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; source=scan(fullpath,-&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"\"&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; source=scan(source,&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: blue; background: white;"&gt;"."&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* input informats ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;informat&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; date &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;date.&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; open high low close adjClose &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;dollar.&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; volume &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;comma.&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: teal; background: white;"&gt;* output formats ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; date &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;date.&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; open high low close adjClose &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;dollar12.2&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt; volume &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: #0000c0; background: white;"&gt;comma12.&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: fuchsia; background: white;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'SAS Monospace'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2014 05:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181093#M46133</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2014-09-02T05:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple Excel files while maintaining their identities</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181094#M46134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Scott,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the detailed reply and appreciate the sample code as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I was referring to the input files. I'm planning to keep them unedited/untouched and carry on with data preparation/analysis on a single platform. If this point wasn't clear, I apologize.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Introducing a step utilizing VBA, Powershell etc, adds an extra step to this process (from my point of view at least) that I'd rather avoid. On top of that, I've never used those systems before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, since I was able to solve my problem in R and given that I can complete my analysis in R, I've accomplished what I was after, that is, completing this process in a single platform.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2014 05:52:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181094#M46134</guid>
      <dc:creator>erickbernard</dc:creator>
      <dc:date>2014-09-02T05:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple Excel files while maintaining their identities</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181095#M46135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="-1" data-externalid="" data-presence="null" data-userid="845503" data-username="erickbernard" href="https://communities.sas.com/people/erickbernard" id="jive-84550325018377542826186"&gt;erickbernard&lt;/A&gt; There is really no need to use an other language as SAS.&amp;nbsp; I do not understand why you are posting something here for SAS and switch into R programming. &lt;BR /&gt;Probably you are not educated with using SAS. Form the old time very advanced data-manipulation until modern time advanced analytics.&lt;/P&gt;&lt;P&gt;One major difference to a lot of other tools,&amp;nbsp; Excel probably also R a up to some level, it is possible to have traceable auditable secured environments and processes.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An other sample for processing all files using wildcarding is:&lt;/P&gt;&lt;P&gt;(o boy you should imagine how many soluitions are possible with SAS):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename impcsv '/folders/myfolders' ; &lt;/P&gt;&lt;P&gt; &lt;BR /&gt;filename impcsv ' /folders/myshortcuts/ikke'; &lt;/P&gt;&lt;P&gt;data orderlst (keep= x y z q order part eval) ;&lt;BR /&gt;&amp;nbsp; length filename filenmcr $250 ;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain _nfl -1 eovfl&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; length z $3 q $1 order part eval $16&amp;nbsp;&amp;nbsp; ; retain order part eval ; /* the targeted lays out */ &lt;BR /&gt;&amp;nbsp; infile impcsv(12345*.csv) filename=filenmcr eov=eovfl eof=tailer end=endfl missover dsd dlm=";"&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; input @ ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; if ( eovfl or _nfl &amp;lt;0 ) then link header; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; _nfl=_nfl+1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; input x y z q ;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; output ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if ( endfl ) then link allfil ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;return;&lt;/P&gt;&lt;P&gt;header:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename=filenmcr;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "-- " filename " --"; _nfl=1 ; eovfl=0; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input&amp;nbsp; ; /* advance one line, ignoring the header */ &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; part=scan(filename,-6,"_"); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; order=scan(filename,-4,"_");&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; eval=scan(filename,-3,"_");&amp;nbsp; &lt;BR /&gt;return;&lt;/P&gt;&lt;P&gt;tailer:&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "total records" part _nfl / ; &lt;BR /&gt;return;&amp;nbsp; &lt;BR /&gt;allfil:&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put "processing done" / ; &lt;BR /&gt;return;&amp;nbsp; &lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2014 06:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combining-multiple-Excel-files-while-maintaining-their/m-p/181095#M46135</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-09-02T06:39:40Z</dc:date>
    </item>
  </channel>
</rss>

