<?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 Create Folders in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173990#M33409</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know if this is even possible, but I'm just going to throw this question out there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was wondering if SAS has the ability to create folders?&amp;nbsp; For example, suppose I automatically run code every week that generates a host of output files.&amp;nbsp; Suppose I output them in C:\SAS\Reports, but I want to have a new subfolder with the date each time the reports are generated so that this week they are output to &lt;SPAN style="font-size: 13.3333330154419px;"&gt;C:\SAS\Reports\2015-02-20 and next week they are output to &lt;SPAN style="font-size: 13.3333330154419px;"&gt;C:\SAS\Reports\2015-02-27, and so on.&amp;nbsp; This way, I don't have to manually create a new folder each time and move all the files from one place to another.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Feb 2015 21:51:57 GMT</pubDate>
    <dc:creator>djbateman</dc:creator>
    <dc:date>2015-02-18T21:51:57Z</dc:date>
    <item>
      <title>Create Folders in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173990#M33409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know if this is even possible, but I'm just going to throw this question out there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was wondering if SAS has the ability to create folders?&amp;nbsp; For example, suppose I automatically run code every week that generates a host of output files.&amp;nbsp; Suppose I output them in C:\SAS\Reports, but I want to have a new subfolder with the date each time the reports are generated so that this week they are output to &lt;SPAN style="font-size: 13.3333330154419px;"&gt;C:\SAS\Reports\2015-02-20 and next week they are output to &lt;SPAN style="font-size: 13.3333330154419px;"&gt;C:\SAS\Reports\2015-02-27, and so on.&amp;nbsp; This way, I don't have to manually create a new folder each time and move all the files from one place to another.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 21:51:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173990#M33409</guid>
      <dc:creator>djbateman</dc:creator>
      <dc:date>2015-02-18T21:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Create Folders in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173991#M33410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DCREATE function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 21:55:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173991#M33410</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-02-18T21:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create Folders in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173992#M33411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or use call system (in a data step) or the X statement (anywhere in SAS code).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 06:35:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173992#M33411</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-02-19T06:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Create Folders in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173993#M33412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;%MACRO&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; check_dir(dir=) &lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OPTIONS NOXWAIT ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%LOCAL&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; rc fileref ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; rc = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%SYSFUNC&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(FILENAME(fileref,&amp;amp;dir)) ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%IF&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%SYSFUNC&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(FEXIST(&amp;amp;fileref)) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%THEN&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%PUT&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; NOTE: Directory &amp;amp;dir does already exist. ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%ELSE&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%DO&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%SYSEXEC&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; MD &amp;amp;dir ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%PUT&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%SYSFUNC&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(SYSMSG()) Directory is created. ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%END&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%LET&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; rc=&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;%SYSFUNC&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(FILENAME(fileref)) ; &lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; check_dir ;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;%&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="color: #000000; background-color: #ffffff;"&gt;check_dir&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;(dir = c:\temp\DATA );&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 08:43:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173993#M33412</guid>
      <dc:creator>Jaheuk</dc:creator>
      <dc:date>2015-02-19T08:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create Folders in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173994#M33413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At the risk of being obnoxious, me still think DCREAT is the better option. Let SAS to worry about OS. You went a great deal of using Macro, you can host your OS independent directory into Macro variable, so it even makes more sense for you to NOT use 'MD'.&amp;nbsp;&amp;nbsp; What if later on your system is being migrated to Linux (or any other OS that SAS is running on)? switch it to 'mkdir'?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just my2cents,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 14:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173994#M33413</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-02-19T14:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create Folders in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173995#M33414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since one already has to consider the underlying OS's naming syntax when using any of the methods, I don't see the possible migration as a major argument. Personally, I would use the filename pipe and data _null_ step method to get a comprehensive log in case something went wrong.&lt;/P&gt;&lt;P&gt;In a case where the "create a directory" function is done via macro, only one macro needs to be adapted to a new platform, but all calls need to be checked for syntax anyway (a "C:\" in a UNIX path name may have interesting consequences)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 14:32:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173995#M33414</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-02-19T14:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Create Folders in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173996#M33415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would agree with you Hai.kuo, for the reasons you have given, and also that piping commands out to system sometimes is blocked by admin, and if it doesn't work - i.e. macro does not work correctly, you do run the risk of removing things unintentionally, or creating loads of unwanted folders etc. temporary areas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 14:32:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173996#M33415</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-19T14:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create Folders in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173997#M33416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;At the risk of appearing vain, here's a sample I submitted a few years ago - &lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="31" data-containertype="14" data-objectid="71369" data-objecttype="1" href="https://communities.sas.com/thread/71369"&gt;https://communities.sas.com/thread/71369&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2015 17:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Folders-in-SAS/m-p/173997#M33416</guid>
      <dc:creator>rcwright</dc:creator>
      <dc:date>2015-02-19T17:00:42Z</dc:date>
    </item>
  </channel>
</rss>

