<?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: save file names in dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/save-file-names-in-dataset/m-p/67651#M14654</link>
    <description>Thanks!</description>
    <pubDate>Mon, 23 May 2011 18:09:58 GMT</pubDate>
    <dc:creator>SASPhile</dc:creator>
    <dc:date>2011-05-23T18:09:58Z</dc:date>
    <item>
      <title>save file names in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/save-file-names-in-dataset/m-p/67647#M14650</link>
      <description>for instance if c:\temp has the following files&lt;BR /&gt;
test1.txt&lt;BR /&gt;
test2.txt&lt;BR /&gt;
text3.txt&lt;BR /&gt;
&lt;BR /&gt;
How to create a dataset with test1.txt ,test2.txt and test3.txt are saved as values for variable dsn.&lt;BR /&gt;
&lt;BR /&gt;
for instance dataset a will have a variable name dsn with  test1.txt ,test2.txt and test3.txt  as its values.</description>
      <pubDate>Fri, 20 May 2011 02:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/save-file-names-in-dataset/m-p/67647#M14650</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2011-05-20T02:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: save file names in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/save-file-names-in-dataset/m-p/67648#M14651</link>
      <description>This code works on Windows XP.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
/* read files in directory */&lt;BR /&gt;
 %let input=d:\data\2011\sks;&lt;BR /&gt;
 %let dir=%str(%'dir %")&amp;amp;input.%str(\%" /A-D/B/ON%');&lt;BR /&gt;
 filename myfiles pipe %unquote(&amp;amp;dir);&lt;BR /&gt;
 data list1; &lt;BR /&gt;
 infile myfiles truncover;&lt;BR /&gt;
 input dsn $100.;&lt;BR /&gt;
 run;&lt;BR /&gt;
 filename myfiles clear;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 20 May 2011 04:58:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/save-file-names-in-dataset/m-p/67648#M14651</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2011-05-20T04:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: save file names in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/save-file-names-in-dataset/m-p/67649#M14652</link>
      <description>There is another way.&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let mypath=d:\data\2011\sks;&lt;BR /&gt;
data mydir;&lt;BR /&gt;
    length dsn $ 100;&lt;BR /&gt;
    dir      = "&amp;amp;mypath";&lt;BR /&gt;
    rc       = filename("readdir","&amp;amp;mypath");&lt;BR /&gt;
    did      = dopen("readdir");&lt;BR /&gt;
    memcount = dnum(did);&lt;BR /&gt;
	if memcount&amp;gt;0 then do;&lt;BR /&gt;
    do i = 1 to memcount;&lt;BR /&gt;
        dsn = dread(did,i);&lt;BR /&gt;
        output;&lt;BR /&gt;
    end;&lt;BR /&gt;
	end;&lt;BR /&gt;
    rc=dclose(did);&lt;BR /&gt;
    drop rc did memcount i;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 20 May 2011 05:07:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/save-file-names-in-dataset/m-p/67649#M14652</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2011-05-20T05:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: save file names in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/save-file-names-in-dataset/m-p/67650#M14653</link>
      <description>Easy.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
filename txt pipe 'dir c:\temp\test*.txt /b';&lt;BR /&gt;
data txt;&lt;BR /&gt;
 infile txt length=len;&lt;BR /&gt;
 input dsn $varying100. len;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Fri, 20 May 2011 05:31:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/save-file-names-in-dataset/m-p/67650#M14653</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-20T05:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: save file names in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/save-file-names-in-dataset/m-p/67651#M14654</link>
      <description>Thanks!</description>
      <pubDate>Mon, 23 May 2011 18:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/save-file-names-in-dataset/m-p/67651#M14654</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2011-05-23T18:09:58Z</dc:date>
    </item>
  </channel>
</rss>

