<?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 get a list of files in a directory?! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-list-of-files-in-a-directory/m-p/797457#M287550</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=...;

data names;
length fref $8 name $200;
rc = filename(fref,"&amp;amp;path.");
did = dopen(fref);
if did
then do;
  do i = 1 to dnum(did);
    name = dread(did,i);
    output;
  end;
  rc = dclose(did);
end;
rc = filename(fref);
keep name;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 20 Feb 2022 11:16:31 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-02-20T11:16:31Z</dc:date>
    <item>
      <title>How to get a list of files in a directory?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-list-of-files-in-a-directory/m-p/797455#M287548</link>
      <description>&lt;P&gt;I have a directory which has 1000+ .csv files to read-in. The filenames are changing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to get the filename list so that can read-in one by one?! Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 11:05:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-list-of-files-in-a-directory/m-p/797455#M287548</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2022-02-20T11:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a list of files in a directory?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-list-of-files-in-a-directory/m-p/797457#M287550</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=...;

data names;
length fref $8 name $200;
rc = filename(fref,"&amp;amp;path.");
did = dopen(fref);
if did
then do;
  do i = 1 to dnum(did);
    name = dread(did,i);
    output;
  end;
  rc = dclose(did);
end;
rc = filename(fref);
keep name;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 Feb 2022 11:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-list-of-files-in-a-directory/m-p/797457#M287550</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-02-20T11:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a list of files in a directory?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-list-of-files-in-a-directory/m-p/797458#M287551</link>
      <description>&lt;P&gt;Great. But how to use it?!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried and get null&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;14653 %let path=E:\outsas\; 14654 14655 data names; 14656 length fref $8 name $200; 14657 rc = filename(fref,"&amp;amp;path."); 14658 did = dopen(fref); 14659 if did 14660 then do; 14661 do i = 1 to dnum(did); 14662 name = dread(did,i); 14663 output; 14664 end; 14665 rc = dclose(did); 14666 end; 14667 rc = filename(fref); 14668 keep name; 14669 run; NOTE: The data set WORK.NAMES has 0 observations and 1 variables. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2022 11:45:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-list-of-files-in-a-directory/m-p/797458#M287551</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2022-02-20T11:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a list of files in a directory?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-list-of-files-in-a-directory/m-p/797460#M287553</link>
      <description>&lt;P&gt;Which means that either the path is not available in your SAS session, or is empty. Expand the code to see which of that is true:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data names;
length fref $8 name $200;
rc = filename(fref,"&amp;amp;path.");
did = dopen(fref);
if did
then do;
  do i = 1 to dnum(did);
    name = dread(did,i);
    output;
  end;
  rc = dclose(did);
end;
else put "Directory not found!";
rc = filename(fref);
keep name;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 Feb 2022 12:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-a-list-of-files-in-a-directory/m-p/797460#M287553</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-02-20T12:02:46Z</dc:date>
    </item>
  </channel>
</rss>

