<?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: %dir_contents in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776103#M246757</link>
    <description>&lt;P&gt;We don't know what the macro %dir_contents does, but yes, the macro must be assigning the names to the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need more detail about what the macro is doing, please post the code of the macro and state your questions clearly.&lt;/P&gt;</description>
    <pubDate>Sun, 24 Oct 2021 22:51:44 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-10-24T22:51:44Z</dc:date>
    <item>
      <title>%dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776101#M246755</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I have inherited SAS code that I need to understand:&lt;/P&gt;
&lt;PRE&gt;This the code:

 %dir_contents (dir=&amp;amp;mypath., ext=, dsoub=theseFiles, attribs=N);&lt;/PRE&gt;
&lt;P&gt;The top captures all files names from the requested directory, and the file names as observations within a SAS dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run this code:&lt;/P&gt;
&lt;P&gt;it gives me 3 variables. basefile, pathname, file_seq&lt;/P&gt;
&lt;P&gt;and it has 3 rows.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are these 3 fields named automatically?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The next line of the code is:&lt;/P&gt;
&lt;P&gt;1-&lt;/P&gt;
&lt;P&gt;Proc sql;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;delete from thislibname.control where sentfile in (select distinct basefile from thesefiles);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;Regarding 1, this code reaches to files inside&amp;nbsp; folders in a directory, not the folders that reside inside the directory. It goes one layer deep.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%while dir_contents is the list of files in a directory.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone talk about this and resolve this difference?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Oct 2021 23:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776101#M246755</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-10-24T23:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776103#M246757</link>
      <description>&lt;P&gt;We don't know what the macro %dir_contents does, but yes, the macro must be assigning the names to the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need more detail about what the macro is doing, please post the code of the macro and state your questions clearly.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Oct 2021 22:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776103#M246757</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-24T22:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776116#M246764</link>
      <description>&lt;P&gt;Is there no one in your company who can explain to you how these company-developed macros work? If you have to ask the Community how macros developed in your own company work then somebody is not doing their job when handing them over to you.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 01:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776116#M246764</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-10-25T01:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776117#M246765</link>
      <description>&lt;P&gt;Hello PaigeMiller,&lt;/P&gt;
&lt;P&gt;Thanks for the response.&lt;/P&gt;
&lt;P&gt;I will tell you what it does:&lt;/P&gt;
&lt;P&gt;It creates a list of files in a directory and stores them in SAS dataset. It creates 3 variables for output:&lt;/P&gt;
&lt;P&gt;basefile, pathname and file_seq.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the output:&lt;/P&gt;
&lt;P&gt;basefile&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pathname&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; file_seq&lt;/P&gt;
&lt;P&gt;fileA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /dataset1/......&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;fileB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /dataset2/......&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;fileC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /dataset2/......&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wonder if this macro access the files which resides in fileA, because from the codes following this %dir_contents, that is what can be understood.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;The code is:
proc sql;
delete from production.table1 where filename in (select distinct basefile from myfiles).&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Respectfully,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 01:35:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776117#M246765</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-10-25T01:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776118#M246766</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;%dir_contents is not a company developed macro. It is a built-in Macro in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code works well and they didn't hand over their job to me. They want me to learn how to write code in future.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 01:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776118#M246766</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-10-25T01:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776124#M246769</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;%dir_contents is not a company developed macro. It is a built-in Macro in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code works well and they didn't hand over their job to me. They want me to learn how to write code in future.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is NOT a built-in SAS macro and though also not documented in SAS documentation.&lt;/P&gt;
&lt;P&gt;"...they didn't hand over..." If "they" is SAS consulting then this makes such a macro still not "built-in".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you add &lt;EM&gt;option mautolocdisplay;&lt;/EM&gt;&amp;nbsp;to your code then the SAS log will tell you where the .sas file with the macro code is taken from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 04:15:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776124#M246769</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-10-25T04:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776163#M246798</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello PaigeMiller,&lt;/P&gt;
&lt;P&gt;Thanks for the response.&lt;/P&gt;
&lt;P&gt;I will tell you what it does:&lt;/P&gt;
&lt;P&gt;It creates a list of files in a directory and stores them in SAS dataset. It creates 3 variables for output:&lt;/P&gt;
&lt;P&gt;basefile, pathname and file_seq.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the output:&lt;/P&gt;
&lt;P&gt;basefile&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;pathname&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; file_seq&lt;/P&gt;
&lt;P&gt;fileA&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /dataset1/......&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;fileB&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /dataset2/......&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;fileC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /dataset2/......&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wonder if this macro access the files which resides in fileA, because from the codes following this %dir_contents, that is what can be understood.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;The code is:
proc sql;
delete from production.table1 where filename in (select distinct basefile from myfiles).&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Can we see the entire code from this macro?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is your question?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 10:42:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776163#M246798</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-25T10:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776259#M246832</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;%dir_contents have documentation. If it was a company built-in Macro, there wouldn't be a docs for it.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 17:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776259#M246832</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-10-25T17:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776281#M246843</link>
      <description>&lt;P&gt;I just checked for this macro at documentation.sas.com and didn't find it. It also doesn't exist on our SAS installation. I'm curious to know where you found documentation for it. Could it be a third-party add-on?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 19:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776281#M246843</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-10-25T19:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776291#M246851</link>
      <description>&lt;P&gt;Thanks for the response!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It gives errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to add it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 20:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776291#M246851</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-10-25T20:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776292#M246852</link>
      <description>&lt;P&gt;If you are getting an error like this when calling the macro:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It means it doesn't exist and you need to get the source code for it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 20:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776292#M246852</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-10-25T20:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776293#M246853</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;%dir_contents have documentation.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Where? Post the URL.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 20:43:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776293#M246853</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-25T20:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776304#M246859</link>
      <description>&lt;P&gt;&lt;EM&gt;Hello team,&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;This is where I have found it:&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;A href="https://www.google.com/search?q=what+does+%25+dir_contents+do+in+SAS&amp;amp;ei=PSN3YdvYK8T99APs3pHoCA&amp;amp;ved=0ahUKEwib6_GrwubzAhXEPn0KHWxvBI0Q4dUDCA4&amp;amp;uact=5&amp;amp;oq=what+does+%25+dir_contents+do+in+SAS&amp;amp;gs_lcp=Cgdnd3Mtd2l6EAMyCAghEBYQHRAeOgcIABBHELADOgQIABBDOgUIABCRAjoLCAAQgAQQsQMQgwE6DgguEIAEELEDEMcBEKMCOhEILhCABBCxAxCDARDHARCjAjoICAAQgAQQsQM6DgguEIAEELEDEMcBENEDOggILhCABBCxAzoFCAAQgAQ6BQguEIAEOggIABCABBDJAzoFCAAQkgM6BggAEBYQHjoECAAQDToICAAQFhAKEB46CAgAEA0QChAeOgYIABANEB46BQghEKABOgcIIRAKEKABOgUIIRCrAjoFCCEQkgNKBQhAEgExSgQIQRgAUMm7JVjMkCZgnpMmaAJwAXgAgAHGAYgBhxuSAQUyNS4xMJgBAKABAcgBCMABAQ&amp;amp;sclient=gws-wiz" target="_blank"&gt;https://www.google.com/search?q=what+does+%25+dir_contents+do+in+SAS&amp;amp;ei=PSN3YdvYK8T99APs3pHoCA&amp;amp;ved=0ahUKEwib6_GrwubzAhXEPn0KHWxvBI0Q4dUDCA4&amp;amp;uact=5&amp;amp;oq=what+does+%25+dir_contents+do+in+SAS&amp;amp;gs_lcp=Cgdnd3Mtd2l6EAMyCAghEBYQHRAeOgcIABBHELADOgQIABBDOgUIABCRAjoLCAAQgAQQsQMQgwE6DgguEIAEELEDEMcBEKMCOhEILhCABBCxAxCDARDHARCjAjoICAAQgAQQsQM6DgguEIAEELEDEMcBENEDOggILhCABBCxAzoFCAAQgAQ6BQguEIAEOggIABCABBDJAzoFCAAQkgM6BggAEBYQHjoECAAQDToICAAQFhAKEB46CAgAEA0QChAeOgYIABANEB46BQghEKABOgcIIRAKEKABOgUIIRCrAjoFCCEQkgNKBQhAEgExSgQIQRgAUMm7JVjMkCZgnpMmaAJwAXgAgAHGAYgBhxuSAQUyNS4xMJgBAKABAcgBCMABAQ&amp;amp;sclient=gws-wiz&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;and it makes sense.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Respectfully,&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;blue blue&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 21:59:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776304#M246859</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-10-25T21:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776306#M246860</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;It gives errors.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;WHAT error! SAS log please.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1635199213014.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65019iAFC2E83F5D267EC3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1635199213014.png" alt="Patrick_0-1635199213014.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And after "re-engineering the URL":&amp;nbsp;&lt;A href="https://www.pharmasug.org/proceedings/2015/QT/PharmaSUG-2015-QT23.pdf" target="_blank"&gt;https://www.pharmasug.org/proceedings/2015/QT/PharmaSUG-2015-QT23.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you found this macro in some paper so it's definitely not SAS OOTB provided.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 22:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776306#M246860</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-10-25T22:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776311#M246863</link>
      <description>&lt;P&gt;Below worked for me once I've run the macro definition as found in &lt;A href="https://www.pharmasug.org/proceedings/2015/QT/PharmaSUG-2015-QT23.pdf" target="_self"&gt;this paper&lt;/A&gt; AND also fixed the name of the parameter in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1635199792860.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65020i64016E8D10D2B4FF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1635199792860.png" alt="Patrick_0-1635199792860.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;To:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1635199837321.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65021i9DBDF9117F47442B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_1-1635199837321.png" alt="Patrick_1-1635199837321.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro dir_contents(
      dir= /* directory name to process */
      , ext= /* optional extension to filter on */
      , dsout=work.dir_contents /* dataset name to hold the file names */
      , attribs=N /* get file attributes? (Y/N ) */
  );
  %global _dir_fileN;
  %local _syspathdlim _exitmsg _attrib_vars;

  %* verify the required parameter has been provided.;
  %if %length(&amp;amp;dir) = 0 %then
    %do;
      %let _exitmsg = %str(E)RROR: No directory name specified - macro will exit.;
      %goto finish;
    %end;

  %* verify existence of the requested directory name.;
  %if %sysfunc(fileexist(&amp;amp;dir)) = 0 %then
    %do;
      %let _exitmsg = %str(E)RROR: Specified input location, &amp;amp;dir., does not exist - macro
        will exit.;
      %goto finish;
    %end;

  %* set the separator character needed for the full file path:;
  %* (backslash for Windows, forward slash for UNIX systems);
  %if &amp;amp;sysscp = WIN %then
    %do;
      %let _syspathdlim = \;
    %end;
  %else
    %do;
      %let _syspathdlim = /;
    %end;

  /*--- begin data step to capture names of all file names found in the specified
  directory. ---*/
  data &amp;amp;dsout(keep=file_seq basefile pathname);
    length basefile $ 40 pathname $ 1000 _msg $ 1000;

    /* Allocate directory */
    rc=FILENAME('xdir', "&amp;amp;dir");

    if rc ne 0 then
      do;
        _msg = "E" || 'RROR: Unable to assign fileref to specified directory. ' ||
          sysmsg();
        go to finish_datastep;
      end;

    /* Open directory */
    dirid=DOPEN('xdir');

    if dirid eq 0 then
      do;
        _msg = "E" || 'RROR: Unable to open specified directory. ' || sysmsg();
        go to finish_datastep;
      end;

    /* Get number of information items */
    nfiles=DNUM(dirid);

    do j = 1 to nfiles;
      basefile = dread(dirid, j);
      pathname=strip("&amp;amp;dir") || "&amp;amp;_syspathdlim." || strip(basefile);

      %if %length(&amp;amp;ext) %then
        %do;
          /* scan the final "word" of the full file name, delimited by dot character. */
          ext = scan(basefile,-1,'.');

          if ext="&amp;amp;ext." then
            do;
              file_seq + 1;
              output;
            end;
        %end;
      %else
        %do;
          file_seq + 1;
          output;
        %end;
    end;

    /* Close the directory */
    rc=DCLOSE(dirid);

    /* Deallocate the directory */
    rc=FILENAME('xdir');
    call symputx('_dir_fileN', file_seq);
finish_datastep:

    if _msg ne ' ' then
      do;
        call symput('_exitmsg', _msg);
      end;
  run;

  %if %upcase(&amp;amp;attribs)=Y and &amp;amp;_dir_fileN &amp;gt; 0 %then
    %do;

      data _file_attr(keep=file_seq basefile infoname infoval);
        length infoname infoval $ 500;
        set &amp;amp;dsout.;

        /* open each file to get the additional attributes available. */
        rc=filename("afile", pathname);
        fid=fopen("afile");

        /* return the number of system-dependent information items available for the
        external file. */
        infonum=foptnum(fid);

        /* loop to get the name and value of each information item. */
        do i=1 to infonum;
          infoname=foptname(fid,i);
          infoval=finfo(fid,infoname);

          if upcase(infoname) ne 'FILENAME' then
            output;
        end;

        close=fclose(fid);
      run;

      /* transpose each information item into its own variable */
      proc transpose data=_file_attr out=trans_attr(drop=_:);
        by file_seq basefile;
        var infoval;
        id infoname;
      run;

      proc sql noprint;
        select distinct name into : _attrib_vars separated by ', '
          from dictionary.columns
            where memname='TRANS_ATTR' and upcase(name) not in('BASEFILE', 'FILE_SEQ')
              order by varnum;
      quit;

      /* merge back the additional attributes to the related file name. */
      data &amp;amp;dsout.;
        merge &amp;amp;dsout. trans_attr;
        by file_seq basefile;
      run;

      proc datasets nolist memtype=data lib=work;
        delete _file_attr trans_attr;
      run;

      quit;

    %end;

  %if %length(&amp;amp;_exitmsg) = 0 %then
    %let _exitmsg = NOTE: &amp;amp;dsout created with &amp;amp;_dir_fileN. file names;

  %if %length(&amp;amp;ext) %then
    %let _exitmsg = &amp;amp;_exitmsg where extension is equal to &amp;amp;ext.;
  %let _exitmsg = &amp;amp;_exitmsg from &amp;amp;dir..;

%finish:
  %put &amp;amp;_exitmsg;

  %if %length(&amp;amp;_attrib_vars) ne 0 %then
    %do;
      %put;
      %put NOTE: File attributes were requested and have been added to &amp;amp;dsout.. Variable
        names are &amp;amp;_attrib_vars.;
    %end;
%mend dir_contents;


option mautolocdisplay;
%let mypath=c:\temp;

%dir_contents (dir=&amp;amp;mypath., ext=, dsout=theseFiles, attribs=N);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Oct 2021 22:12:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776311#M246863</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-10-25T22:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776318#M246868</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I am not getting errors. I just asked if the macro access to the files in each path.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;BlueBlue&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 22:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776318#M246868</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-10-25T22:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776319#M246869</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;It doesn't matter it is from SAS docs or not. It takes care of some stuff.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 22:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776319#M246869</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-10-25T22:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776320#M246870</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I didn't say it doesn't work. I just aske if it accesses to the files in subdirectory.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 22:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776320#M246870</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-10-25T22:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776323#M246871</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I didn't say it doesn't work. I just aske if it accesses to the files in subdirectory.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why don't you just execute the macro in your environment. That should answer your question. ...or even better try to actually understand the macro code.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 23:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776323#M246871</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-10-25T23:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: %dir_contents</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776362#M246897</link>
      <description>Hello teammate,&lt;BR /&gt;Actually, it lists the files in subdirectory.&lt;BR /&gt;It is abstract. From what I see in the output, I can say, it creates an dataset, observations for this dataset is folder names. %dir_contents list the files in each folder name. It displays folder name in output dataset, but it access to content of each folder.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;blueblue&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Oct 2021 04:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dir-contents/m-p/776362#M246897</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-10-26T04:58:01Z</dc:date>
    </item>
  </channel>
</rss>

