<?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: SAS datasets in a directory in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-datasets-in-a-directory/m-p/746516#M234191</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/357933"&gt;@cgsmoak56&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that your code on it's way to your SAS editor has been through MS Word or something similar, because the syntax errors come from illegal characters used as quotes (around 'dir', 'i' and 'TADB7SAS', and the - in the substring has also been converted to an illegal type of dash. I have corrected these errors in the following code, and it runs without any syntax errors:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data fname(keep=fname);
	length filename $ 200;
	did = dopen('dir');
	do i = 1 to dnum(did);
	filename = dread(did, i);
	ext_name = index(filename, '.');
	if ext_name &amp;gt; 0 then fname = substr(filename, 1, ext_name - 1);
	If upcase(substr(left(reverse(filename)), 1, 10)) eq 'TADB7SAS.' then output;
	end;
	rc = dclose(did);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 08 Jun 2021 17:07:07 GMT</pubDate>
    <dc:creator>ErikLund_Jensen</dc:creator>
    <dc:date>2021-06-08T17:07:07Z</dc:date>
    <item>
      <title>SAS datasets in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-datasets-in-a-directory/m-p/746510#M234189</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The following code used to work for me perfectly to get a list of SAS datasets in a folder. Now with SAS version 9.4, I am getting an error message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename dir "c:\tempsas";&lt;/P&gt;&lt;P&gt;data fname(keep=fname);&lt;BR /&gt;length filename $ 200;&lt;BR /&gt;did = dopen(‘dir’);&lt;BR /&gt;do i = 1 to dnum(did);&lt;BR /&gt;filename = dread(did, i);&lt;BR /&gt;ext_name = index(filename, ‘.’);&lt;BR /&gt;if ext_name &amp;gt; 0 then fname = substr(filename, 1, ext_name – 1);&lt;BR /&gt;If upcase(substr(left(reverse(filename)), 1, 10)) eq ‘TADB7SAS.’ then output;&lt;BR /&gt;end;&lt;BR /&gt;rc = dclose(did);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The log shows the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;77 data fname(keep=fname);&lt;BR /&gt;78 length filename $ 200;&lt;BR /&gt;79 did = dopen(‘dir’);&lt;BR /&gt;_&lt;BR /&gt;386&lt;BR /&gt;200&lt;BR /&gt;76&lt;BR /&gt;ERROR 386-185: Expecting an arithmetic expression.&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;80 do i = 1 to dnum(did);&lt;BR /&gt;81 filename = dread(did, i);&lt;BR /&gt;82 ext_name = index(filename, ‘.’);&lt;BR /&gt;_&lt;BR /&gt;386&lt;BR /&gt;200&lt;BR /&gt;76&lt;BR /&gt;83 if ext_name &amp;gt; 0 then fname = substr(filename, 1, ext_name – 1);&lt;BR /&gt;_&lt;BR /&gt;388&lt;BR /&gt;200&lt;BR /&gt;______&lt;BR /&gt;72&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for any assistance.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jun 2021 16:56:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-datasets-in-a-directory/m-p/746510#M234189</guid>
      <dc:creator>cgsmoak56</dc:creator>
      <dc:date>2021-06-08T16:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS datasets in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-datasets-in-a-directory/m-p/746516#M234191</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/357933"&gt;@cgsmoak56&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It seems that your code on it's way to your SAS editor has been through MS Word or something similar, because the syntax errors come from illegal characters used as quotes (around 'dir', 'i' and 'TADB7SAS', and the - in the substring has also been converted to an illegal type of dash. I have corrected these errors in the following code, and it runs without any syntax errors:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data fname(keep=fname);
	length filename $ 200;
	did = dopen('dir');
	do i = 1 to dnum(did);
	filename = dread(did, i);
	ext_name = index(filename, '.');
	if ext_name &amp;gt; 0 then fname = substr(filename, 1, ext_name - 1);
	If upcase(substr(left(reverse(filename)), 1, 10)) eq 'TADB7SAS.' then output;
	end;
	rc = dclose(did);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Jun 2021 17:07:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-datasets-in-a-directory/m-p/746516#M234191</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2021-06-08T17:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS datasets in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-datasets-in-a-directory/m-p/746520#M234192</link>
      <description>&lt;P&gt;Please post LOG entries into a text box opened on the forum with the &amp;lt;/&amp;gt; icon. As you can see from your post the message window has reformatted the log text so that the _ characters, which should appear directly under the place where the 386-185 and other characters occur and instead appear under the line numbers. The message windows reformat text removing space characters resulting in the misalignment as shown.&lt;/P&gt;
&lt;P&gt;The log would typically show something more like:&lt;/P&gt;
&lt;PRE&gt;79 did = dopen(‘dir’);
               _

&lt;/PRE&gt;
&lt;P&gt;Note that the text box also makes the curly quotes more obvious.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jun 2021 17:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-datasets-in-a-directory/m-p/746520#M234192</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-08T17:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS datasets in a directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-datasets-in-a-directory/m-p/746521#M234193</link>
      <description>&lt;P&gt;Thank you, Your solution worked.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jun 2021 17:26:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-datasets-in-a-directory/m-p/746521#M234193</guid>
      <dc:creator>cgsmoak56</dc:creator>
      <dc:date>2021-06-08T17:26:29Z</dc:date>
    </item>
  </channel>
</rss>

