<?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: Help with generic code to combine multiple files -- can you call file w/ list of files to combin in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258946#M49997</link>
    <description>&lt;P&gt;What of the "full story"&amp;nbsp;did I not provide?&lt;/P&gt;</description>
    <pubDate>Thu, 24 Mar 2016 19:40:25 GMT</pubDate>
    <dc:creator>BeckyBell2355</dc:creator>
    <dc:date>2016-03-24T19:40:25Z</dc:date>
    <item>
      <title>Help with generic code to combine multiple files -- can you call file w/ list of files to combine?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258830#M49943</link>
      <description>&lt;P&gt;We combine a large number of files at once&amp;nbsp;to make one SAS data file. &amp;nbsp;I'd like to create a reusable generic SAS program that doesn't need to be changed each time we combine a new set of files&amp;nbsp;(or as little as possible) -- (Ie., so it doesn't list the files out individually in the code). &amp;nbsp;(I have some knowledge in general programming but am newish to SAS, so please reply like I don't understand much.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The files for each year have the same variables and structure (.txt w/ comma delimited) including a header. &amp;nbsp;BUT-&lt;/P&gt;&lt;P&gt;1. the files are stored in separate&amp;nbsp;folders (and folders include other .txt files we want to exclude), and&lt;/P&gt;&lt;P&gt;2. the folder and file names change each time we get new sets of data files&amp;nbsp;to reflect the new date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of the folders &amp;amp; file names, with "we want" marking those wanted to combine into 1 data set from both folders. &amp;nbsp;(This example is simplified from real situation... more folders and files as well as exceptions aren't always the same from year to year, etc.)&lt;/P&gt;&lt;P&gt;Folder name = C:\EIS\EISFall15&lt;/P&gt;&lt;P&gt;ABC_EISFall2015.txt (---we want)&lt;/P&gt;&lt;P&gt;BCD_EISFall2015.txt (&lt;SPAN&gt;---&lt;/SPAN&gt;we want)&lt;/P&gt;&lt;P&gt;CDE_WW_EISFall2015.txt (&lt;SPAN&gt;---&lt;/SPAN&gt;we want)&lt;/P&gt;&lt;P&gt;CDE_EISFall2015.txt (---want to EXCLUDE)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Folder name = C:\EIS\EISSpring16&lt;/P&gt;&lt;P&gt;ABC_&lt;SPAN&gt;EISS&lt;/SPAN&gt;&lt;SPAN&gt;pring&lt;/SPAN&gt;&lt;SPAN&gt;16&lt;/SPAN&gt;.txt (&lt;SPAN&gt;---&lt;/SPAN&gt;we want)&lt;/P&gt;&lt;P&gt;BCD_&lt;SPAN&gt;EISS&lt;/SPAN&gt;&lt;SPAN&gt;pring&lt;/SPAN&gt;&lt;SPAN&gt;16&lt;/SPAN&gt;.txt (&lt;SPAN&gt;---&lt;/SPAN&gt;we want)&lt;/P&gt;&lt;P&gt;CDE_WW_&lt;SPAN&gt;EISS&lt;/SPAN&gt;&lt;SPAN&gt;pring&lt;/SPAN&gt;&lt;SPAN&gt;16&lt;/SPAN&gt;.txt (&lt;SPAN&gt;---&lt;/SPAN&gt;we want)&lt;/P&gt;&lt;P&gt;CDE_&lt;SPAN&gt;EISS&lt;/SPAN&gt;&lt;SPAN&gt;pring&lt;/SPAN&gt;&lt;SPAN&gt;16&lt;/SPAN&gt;.txt (&lt;SPAN&gt;---want to EXCLUDE)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there a way to use a macro or something which calls a&amp;nbsp;list of file names/locations&amp;nbsp;(like a list for each year saved in different file, not in this generic code) so I would only have to change the name of that file list in the generic file to create&amp;nbsp;files for different years?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;generic code that loops and creates the combine data file...&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;generic code that opens directory fiie C:\EIS\EIS1516.txt &amp;nbsp;[that name would be the only thing that would need to change each year]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;generic code loops through and combines only the files listed in the directory file to create 1 large data file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;generic code saves SAS data file in same location as directory file.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is this possible? &amp;nbsp;Or other thoughts/ideas? &amp;nbsp;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Becky&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 14:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258830#M49943</guid>
      <dc:creator>BeckyBell2355</dc:creator>
      <dc:date>2016-03-24T14:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258832#M49945</link>
      <description>&lt;P&gt;Yes. Your issue will be getting your file list, but once you do you can use the filevar option to provide the file name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4 class="xis-argument"&gt;FILEVAR=&lt;SPAN class="xis-userSuppliedValue"&gt;variable&lt;/SPAN&gt;&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;specifies a variable whose change in value causes the INFILE statement to close the current input file and open a new one. When the next INPUT statement executes, it reads from the new file that the FILEVAR= variable specifies. Like automatic variables, this variable is not written to the data set.&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-do-I-write-a-macro-to-import-multiple-text-files-that-have/ta-p/223627" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-do-I-write-a-macro-to-import-multiple-text-files-that-have/ta-p/223627&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See Example 5&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lestmtsref/68024/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To generate your list, use OS commands - what is your OS?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 14:34:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258832#M49945</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-24T14:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258841#M49951</link>
      <description>&lt;P&gt;Windows 7 is my OS.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 14:54:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258841#M49951</guid>
      <dc:creator>BeckyBell2355</dc:creator>
      <dc:date>2016-03-24T14:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258848#M49955</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, this is a more advanced topic, you would want someone to design - i.e. functional design spec - and build a nice macro or tool for this really. &amp;nbsp;Here is some code, step one it gets a list of files and directories in a root directory. &amp;nbsp;It uses this list to create a call per CSV file (note the where clause - change as you need) to run the import code, in this I just show a basic input statement:&lt;/P&gt;
&lt;PRE&gt;filename d pipe 'dir "s:\temp\rob" /b /s';
data dirs;
  length buffer $1000;
  infile d dlm="¬";
  input buffer $;
run;

data _null_;
  set dirs (where=(index(buffer,".csv")&amp;gt;0);
  call execute(cat('data want',strip(put(_n_,best.),'; infile "',strip(buffer),'"; input a $ b $; run;'));
run;&lt;/PRE&gt;
&lt;P&gt;Note this was designed for Windows - i.e. dir is a windows command.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 15:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258848#M49955</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-24T15:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258855#M49960</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;You mentioned FILEVAR but did not use it. I don't see how your example will extrapolate to what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/56040"&gt;@BeckyBell2355&lt;/a&gt;&amp;nbsp;needs although&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/56040"&gt;@BeckyBell2355&lt;/a&gt;&amp;nbsp;has not given us the full story.&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, this is a more advanced topic, you would want someone to design - i.e. functional design spec - and build a nice macro or tool for this really. &amp;nbsp;Here is some code, step one it gets a list of files and directories in a root directory. &amp;nbsp;It uses this list to create a call per CSV file (note the where clause - change as you need) to run the import code, in this I just show a basic input statement:&lt;/P&gt;
&lt;PRE&gt;filename d pipe 'dir "s:\temp\rob" /b /s';
data dirs;
  length buffer $1000;
  infile d dlm="¬";
  input buffer $;
run;

data _null_;
  set dirs (where=(index(buffer,".csv")&amp;gt;0);
  call execute(cat('data want',strip(put(_n_,best.),'; infile "',strip(buffer),'"; input a $ b $; run;'));
run;&lt;/PRE&gt;
&lt;P&gt;Note this was designed for Windows - i.e. dir is a windows command.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 15:28:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258855#M49960</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-24T15:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258874#M49964</link>
      <description>&lt;P&gt;Sorry, I can't see where I mentioned FILEVAR. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OP requested a method to import various CSV files from different directories, I provide code to do this? &amp;nbsp;First step gets list of all files in root directory and subfolders - just assuming here - then generates a datastep import for each CSV file. &amp;nbsp;True, it will need modification based on what folder she has, what the files are, what exclusions to apply etc., but then I am not contracted to develop the, just show some general code.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 17:00:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258874#M49964</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-24T17:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258935#M49991</link>
      <description>&lt;P&gt;Sorry I can't keep the "Super Users" straight.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 19:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258935#M49991</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-24T19:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258946#M49997</link>
      <description>&lt;P&gt;What of the "full story"&amp;nbsp;did I not provide?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 19:40:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258946#M49997</guid>
      <dc:creator>BeckyBell2355</dc:creator>
      <dc:date>2016-03-24T19:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258949#M49998</link>
      <description>&lt;P&gt;I want to provide the list of the files to import -- not all files in the folders should be combined. &amp;nbsp;This is the problem I'm trying to get around. &amp;nbsp;The other files need to be in the same folder and can't be moved. &amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm fine with creating a seperate text file by hand that lists each filename including directory --- I just don't want those listed&amp;nbsp;in the import program because they will keep changing -- however, I want to still be able to rerun last year's list of files.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 19:47:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258949#M49998</guid>
      <dc:creator>BeckyBell2355</dc:creator>
      <dc:date>2016-03-24T19:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258953#M50000</link>
      <description>&lt;P&gt;Create your list by hand.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Store last years list somewhere.&lt;/P&gt;
&lt;P&gt;Make it a sas dataset, with a variable that has the files you want to import.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then the post I linked to above should work - all files are read into one data set, once you've specified your input statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest trying it on some test files and seeing how it works for you. Post back if you have issues.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your exact use case is also listed in the documentation - which was also provided above.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 19:51:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258953#M50000</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-24T19:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258955#M50002</link>
      <description>&lt;P&gt;How each file is read now. &amp;nbsp;All as one data stream or as individual files. &amp;nbsp;Using DATA STEP or PROC IMPORT etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you need/want to change any of that?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 19:55:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258955#M50002</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-24T19:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258967#M50011</link>
      <description>&lt;P&gt;It was changed to a Data Step that looped and picked up all .txt files in specific folders because it was much faster that PROC IMPORT for each file&amp;nbsp; -- the issue was that some files shouldn't be included. &amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm going to look into the other response and see if I can make that work.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 20:46:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258967#M50011</guid>
      <dc:creator>BeckyBell2355</dc:creator>
      <dc:date>2016-03-24T20:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258968#M50012</link>
      <description>&lt;P&gt;One quick way to change your current process - use the FILENAME option - this provides an variable that is the file name so you can trace&amp;nbsp;the source for each record.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can delete out the ones you don't want. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the exclusion list is small this is probably a quicker way to go...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 20:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258968#M50012</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-24T20:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258973#M50016</link>
      <description>&lt;P&gt;You might get better help if you show the code you use now or at least a working example.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/56040"&gt;@BeckyBell2355&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;It was changed to a Data Step that looped and picked up all .txt files in specific folders because it was much faster that PROC IMPORT for each file&amp;nbsp; -- the issue was that some files shouldn't be included. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm going to look into the other response and see if I can make that work.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 21:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258973#M50016</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-24T21:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help with generic code to combine multiple files -- can you call file w/ list of files to combin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258975#M50017</link>
      <description>&lt;P&gt;If the files and folder structure are that consistent then something like this might give you a start on building a list of files and locations.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data buildlist;
   input org $;
   length filevar $ 100;
   do year=15 to 16;
      filevar=cats("C:\EIS\EISFall",year,"\",org,"_EISFall20",year,".txt");
      output;
   end;
datalines;
ABC
BCD
CDE_WW
;
run;
proc sort data=buildlist out=wantlist (keep=filevar); 
   by year org;
run; 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The want list could be used in a set statement and the filevar to control the reading.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: I heartily disapprove of 2 digit year folder names because the above code would be simpler and work across 1999 to 2000 if you had historical files that needed processing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And from your folder names I wouldn't be suprised if you had a Spring as well. You could add a loop with those values to build the names also.&lt;/P&gt;
&lt;P&gt;The keys are consistent naming and hopefully being able to build the list of base values (I called Org for no real reason).&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 21:13:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-generic-code-to-combine-multiple-files-can-you-call/m-p/258975#M50017</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-24T21:13:29Z</dc:date>
    </item>
  </channel>
</rss>

