<?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: How to create a text file that has file names in a directory in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98349#M20772</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This code produces the list that I want. Thank you so much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Apr 2012 22:36:12 GMT</pubDate>
    <dc:creator>tesu</dc:creator>
    <dc:date>2012-04-30T22:36:12Z</dc:date>
    <item>
      <title>How to create a text file that has file names in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98345#M20768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my "D:\work\" folder, I have two types of files, that are "8-digit-number_type.dbf" and "character_type.dbf" as follows: 00093282.dbf, 00345602.dbf, 69209340.dbf, 69806980.dbf, 92406482.dbf, 99999999.dbf,... aaa.dbf, bbb.dbf, ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to take only the "8-digit-number_type.dbf" files, and exclude the character type files. (I don't care about the character type files.) Then, I want to create a text file (say, namelist.txt) that contains the list of names of the dbf files as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;00093282&lt;/P&gt;&lt;P&gt;00345602&lt;/P&gt;&lt;P&gt;69209340&lt;/P&gt;&lt;P&gt;69806980&lt;/P&gt;&lt;P&gt;99999999&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I do that in SAS?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Apr 2012 23:17:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98345#M20768</guid>
      <dc:creator>tesu</dc:creator>
      <dc:date>2012-04-29T23:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a text file that has file names in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98346#M20769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Start with this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename toto PIPE "DIR ""D:\work\*.dbf"" " console=min;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;length name $200;&lt;BR /&gt;infile toto firstobs=6 truncover;&lt;BR /&gt;input a$ b$ c$ file $char200.;&lt;BR /&gt;file "D:\work\namelist.txt";&lt;BR /&gt;name = trim(tranwrd(upcase(file),".DBF",""));&lt;BR /&gt;if anyalpha(name) = 0 then put name;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2012 00:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98346#M20769</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-04-30T00:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a text file that has file names in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98347#M20770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... same idea, use a pipe but with DIR/B...&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;filename x pipe 'dir/b "z:\*.dbf" ' ;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;filename y 'z:\namelist.txt';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;data _null_;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;infile x dlm='.';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;file y;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;input name : $20.;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;if ^verify(trim(name),'0123456789') then put name;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2012 00:24:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98347#M20770</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-04-30T00:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a text file that has file names in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98348#M20771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I run it, and the namelist.txt looks like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;35,548 00093282&lt;/P&gt;&lt;P&gt;17,539 00095480&lt;/P&gt;&lt;P&gt;12,406 00095520&lt;/P&gt;&lt;P&gt;38,854 00095602&lt;/P&gt;&lt;P&gt;10,927 00098880&lt;/P&gt;&lt;P&gt;18,670 00099999&lt;/P&gt;&lt;P&gt;29,819 00340240&lt;/P&gt;&lt;P&gt;12,952 00340560&lt;/P&gt;&lt;P&gt;569,260 00345602&lt;/P&gt;&lt;P&gt;198,085 00346162&lt;/P&gt;&lt;P&gt;3,458 00347560&lt;/P&gt;&lt;P&gt;25,072 00349999&lt;/P&gt;&lt;P&gt;18,670 00400040&lt;/P&gt;&lt;P&gt;3,010 00409999&lt;/P&gt;&lt;P&gt;65,737 00801692&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some numbers that I don't want in the first column. But I can remove the first column later.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2012 22:35:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98348#M20771</guid>
      <dc:creator>tesu</dc:creator>
      <dc:date>2012-04-30T22:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a text file that has file names in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98349#M20772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This code produces the list that I want. Thank you so much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2012 22:36:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98349#M20772</guid>
      <dc:creator>tesu</dc:creator>
      <dc:date>2012-04-30T22:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a text file that has file names in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98350#M20773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take Mike's code, it's much better, mine was just an approximation. - PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2012 23:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98350#M20773</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-04-30T23:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a text file that has file names in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98351#M20774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you only want 8 digit file name ,I prefer to Perl Regular Expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if prxmatch('/\d{8}/',name) then put name;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 05:53:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-that-has-file-names-in-a-directory/m-p/98351#M20774</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-05-02T05:53:32Z</dc:date>
    </item>
  </channel>
</rss>

