<?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: Listing Files in a directory in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Listing-Files-in-a-directory/m-p/614285#M179523</link>
    <description>&lt;P&gt;To be able to use filename pipe, XCMD needs to be enabled, which is not the case out-of-the-box in a SAS BI Server setup.&lt;/P&gt;
&lt;P&gt;You need to ask your SAS administrator do enable this on the workspace server yo are using.&lt;/P&gt;</description>
    <pubDate>Sun, 29 Dec 2019 14:23:47 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-12-29T14:23:47Z</dc:date>
    <item>
      <title>Listing Files in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Listing-Files-in-a-directory/m-p/614283#M179522</link>
      <description>&lt;P&gt;I found this code for listing directories at:&lt;A href="http://support.sas.com/kb/24/820.html" target="_blank" rel="noopener"&gt;http://support.sas.com/kb/24/820.html&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename DIRLIST pipe 'dir "C:\Documents and Settings" /s';

data dirlist ;
     length buffer $256 ;

     infile dirlist length=reclen ;

     input buffer $varying256. reclen ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However I get the following error when I insert my path. I am using SAS UE so I am certain that I should have access to my folders.&lt;/P&gt;&lt;P&gt;Can someone tell me why this occurs and how to overcome the issue?&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 filename DIRLIST pipe 'dir "folders/myfolders/aptensio_secalc/finalsas" /s';&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: Insufficient authorization to access PIPE.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: Error in the FILENAME statement.&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;75&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 data dirlist ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77 length buffer $256 ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;79 infile dirlist length=reclen ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;80&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81 input buffer $varying256. reclen ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;82 run ;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: No logical assign for filename DIRLIST.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;WARNING: The data set WORK.DIRLIST may be incomplete. When this step was stopped there were 0 observations and 1 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;83&lt;/DIV&gt;&lt;/DIV&gt;&lt;PRE class="sasLog"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Dec 2019 13:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Listing-Files-in-a-directory/m-p/614283#M179522</guid>
      <dc:creator>jacksonan123</dc:creator>
      <dc:date>2019-12-29T13:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Listing Files in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Listing-Files-in-a-directory/m-p/614285#M179523</link>
      <description>&lt;P&gt;To be able to use filename pipe, XCMD needs to be enabled, which is not the case out-of-the-box in a SAS BI Server setup.&lt;/P&gt;
&lt;P&gt;You need to ask your SAS administrator do enable this on the workspace server yo are using.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Dec 2019 14:23:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Listing-Files-in-a-directory/m-p/614285#M179523</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-29T14:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Listing Files in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Listing-Files-in-a-directory/m-p/614286#M179524</link>
      <description>I am using SAS University edition so I guess the question is it possible to&lt;BR /&gt;enable XCMD with SAS UE in order to use filename pipe?&lt;BR /&gt;&lt;BR /&gt;I looked on the help site at&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/How-to-enable-XCMD-in-SAS-Univ" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/How-to-enable-XCMD-in-SAS-Univ&lt;/A&gt;&lt;BR /&gt;ersity-Edition/td-p/265868 and it can't be done on SAS UE.&lt;BR /&gt;&lt;BR /&gt;Thanks for your response.&lt;BR /&gt;</description>
      <pubDate>Sun, 29 Dec 2019 14:58:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Listing-Files-in-a-directory/m-p/614286#M179524</guid>
      <dc:creator>jacksonan123</dc:creator>
      <dc:date>2019-12-29T14:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Listing Files in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Listing-Files-in-a-directory/m-p/614298#M179533</link>
      <description>&lt;P&gt;You can do it with SAS means:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data files (keep=fname);
rc = filename("mydir","/folders/myfolders");
did = dopen("mydir");
if did &amp;gt; 0
then do i = 1 to dnum(did);
  fname = dread(did,i);
  output;
end;
rc = dclose(did);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Further SAS means (fopen, foptnum, foptname, finfo) can be used to retrieve details of files.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Dec 2019 17:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Listing-Files-in-a-directory/m-p/614298#M179533</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-29T17:58:29Z</dc:date>
    </item>
  </channel>
</rss>

