<?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 reading multiple files in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/reading-multiple-files/m-p/72138#M20886</link>
    <description>Hi SAS users,&lt;BR /&gt;
&lt;BR /&gt;
I have a question regarding reading multiple files.  I have a folder containing 13 text files with filenames starting with a number (ex. 1.txt, 2.txt, 3.txt....) and they all have the same variables but different data values.  I'd like to use the files 1 and 2, 2 and 3, 3 and 4, 4 and 5, and so forth in successive executions such that I can stack the descriptive statistics generated for 1 and 2, 2 and 3, 3 and 4....into one large file.  So, each combination (eg. 1.txt, 2.txt; 2.txt, 3.txt, etc) will be given an id followed by the descriptive statistics.  Can anybody offer some suggestions? Thanks!</description>
    <pubDate>Thu, 17 Sep 2009 18:29:28 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-09-17T18:29:28Z</dc:date>
    <item>
      <title>reading multiple files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-multiple-files/m-p/72138#M20886</link>
      <description>Hi SAS users,&lt;BR /&gt;
&lt;BR /&gt;
I have a question regarding reading multiple files.  I have a folder containing 13 text files with filenames starting with a number (ex. 1.txt, 2.txt, 3.txt....) and they all have the same variables but different data values.  I'd like to use the files 1 and 2, 2 and 3, 3 and 4, 4 and 5, and so forth in successive executions such that I can stack the descriptive statistics generated for 1 and 2, 2 and 3, 3 and 4....into one large file.  So, each combination (eg. 1.txt, 2.txt; 2.txt, 3.txt, etc) will be given an id followed by the descriptive statistics.  Can anybody offer some suggestions? Thanks!</description>
      <pubDate>Thu, 17 Sep 2009 18:29:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-multiple-files/m-p/72138#M20886</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-09-17T18:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: reading multiple files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-multiple-files/m-p/72139#M20887</link>
      <description>I'd be tempted to start with a filename like:&lt;BR /&gt;
Filename mydata '&lt;PATH&gt;\*.txt'; /*expanding path to your location and the appropriate wildcard for your system. This will attempt to read ALL files with TXT extension in the location. */&lt;BR /&gt;
&lt;BR /&gt;
Then in the data step have :&lt;BR /&gt;
    LENGHT FILEVARNAME $ 80 ; /*long enough to include entire path and file names above. */&lt;BR /&gt;
and add the option FILENAME= Filevarname on the INFILE statement used to read the data.&lt;BR /&gt;
&lt;BR /&gt;
This reads all of the text data files with a temporary variable that is not added to your data named FILEVARNAME (or what ever you'd like to call it) that can then be parsed using string functions to identify your original files and add additional variables describing the groups you want to look at later. With out knowing which summary statistics you want cant go much further but CLASS statements in PROC SUMMARY with attention to _type_ in output might get you started.&lt;/PATH&gt;</description>
      <pubDate>Thu, 17 Sep 2009 19:56:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-multiple-files/m-p/72139#M20887</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2009-09-17T19:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: reading multiple files</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/reading-multiple-files/m-p/72140#M20888</link>
      <description>Thanks much ballardw.</description>
      <pubDate>Fri, 25 Sep 2009 23:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/reading-multiple-files/m-p/72140#M20888</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-09-25T23:55:50Z</dc:date>
    </item>
  </channel>
</rss>

