<?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: Automatic Directory Creation - Windows in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42268#M10957</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not looking for the folder name to be the current date. I just want it to be the month number (jan is 1, Feb is 2 etc.), month abbreviation and Year (01 - Jan - 2012)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I want to make these on a network drive not the local drive... how would I go about that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Jan 2012 16:53:49 GMT</pubDate>
    <dc:creator>vomer</dc:creator>
    <dc:date>2012-01-31T16:53:49Z</dc:date>
    <item>
      <title>Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42265#M10954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I run some sas queries on a monthly basis and they export data to specific folders. Problem is I have to manually make these folders before I run the code so SAS wont error out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to automate this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My folders have to be named in this fashion:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;number of the Month - Name of the Month Year (12 - Dec 2011). I would also like to create a subfolder called Excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also is there any way the month and number is populated automatically...so when I run this in January it changes to (1 - Jan 2012)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please provide the codes needed if possible...I am very new to SAS. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 15:48:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42265#M10954</guid>
      <dc:creator>vomer</dc:creator>
      <dc:date>2012-01-31T15:48:27Z</dc:date>
    </item>
    <item>
      <title>Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42266#M10955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use the "X" command to shell out to Windows to create it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance, if you had a macro variable with the name of the directory, it might look something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET yrmo=12-Dec2011;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x "mkdir c:\mypath\&amp;amp;yrmo";&lt;/P&gt;&lt;P&gt;x "mkdir c:\mypath\&amp;amp;yrmo\excel";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doc Muhlbaier&lt;/P&gt;&lt;P&gt;Duke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 16:32:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42266#M10955</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2012-01-31T16:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42267#M10956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assume you have access to C:\, and you want to use current date to name the folder:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;mc=catx('-',month(today()),put(today(),monyy7.));&lt;/P&gt;&lt;P&gt;call symput('d',cats('md c:\',mc,'\excel\'));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x "&amp;amp;d";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note: TODAY() helps to extract today's date. It also seems to me that dos command "md" does not support blank, so you will end up with no blank between mmm and yyyy. You can also add:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options noxwait;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at the beginning of the code to avoid manually get out of dos window.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly Regards,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 16:43:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42267#M10956</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-01-31T16:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42268#M10957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not looking for the folder name to be the current date. I just want it to be the month number (jan is 1, Feb is 2 etc.), month abbreviation and Year (01 - Jan - 2012)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I want to make these on a network drive not the local drive... how would I go about that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 16:53:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42268#M10957</guid>
      <dc:creator>vomer</dc:creator>
      <dc:date>2012-01-31T16:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42269#M10958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have tried my code above, it does exactly what you want. MONTH() to extract month info from TODAY().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does not make a difference whether you are making folders locally or on network drive, as long as you have write access and it has been mapped correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 17:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42269#M10958</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-01-31T17:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42270#M10959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Haikuo. I have one last question:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My directory is named in this fashion:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\AB&amp;amp;C\Reports &amp;amp; Tests\Folder&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your query seems to get stuck becuse of the "&amp;amp;" in my directory name...I unfortunately cannot rename it...how can I made the code work with this path?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 17:20:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42270#M10959</guid>
      <dc:creator>vomer</dc:creator>
      <dc:date>2012-01-31T17:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42271#M10960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Try this one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;mc=catx('-',month(today()),put(today(),monyy7.));&lt;/P&gt;&lt;P&gt;call symput('d',cats('md %nrbquote("c:\AB%nrbquote(&amp;amp;)C\Reports &amp;amp; Tests\")',mc,'\excel\'));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x "&amp;amp;d";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: I am really a newbie in term of Macro language. So my code above would inevitably&amp;nbsp; falls clumsy.&amp;nbsp; Macro experts please recue!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 17:40:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42271#M10960</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-01-31T17:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42272#M10961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no need to use macro variables at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newdir=dcreate(catx('-', month(today()), put(today(), monyy7.)), 'C:\AB&amp;amp;C\Reports &amp;amp; Tests\');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 18:41:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42272#M10961</guid>
      <dc:creator>polingjw</dc:creator>
      <dc:date>2012-01-31T18:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42273#M10962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;awesome! I did not know the existence of&amp;nbsp; dcreate(). Thanks a lot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 18:50:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42273#M10962</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-01-31T18:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42274#M10963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make sure to put the month with leading zero. Otherwise the directories will not sort properly in most browsing tools like Windows Explorer.&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newdir=dcreate(catx('-', put(month(today()),z2.), put(today(), monyy7.)), 'C:\AB&amp;amp;C\Reports &amp;amp; Tests\');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I have been doing lately for date stamps in files or directory is using the YYMMDD format.&amp;nbsp; That sorts properly and avoids confusion over which part is month and which is day.&lt;/P&gt;&lt;P&gt;For you report structure perhaps you want 2012 - 01 - January ?&amp;nbsp; Or perhaps introduce a year folder?&amp;nbsp; 2012\01 - January ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 21:59:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42274#M10963</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-01-31T21:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42275#M10964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This worked but I just have 1 small issue. When I run this I don't get a space between the month and the year... so it looks like : 02 - FEB2012 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How should I modify it so it looks like : 02 - FEB 2012 (note space after month)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, is there any way to modify this code so it creates the previous month's folder? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 19:59:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42275#M10964</guid>
      <dc:creator>vomer</dc:creator>
      <dc:date>2012-02-02T19:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42276#M10965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pull out the month and year separately.&amp;nbsp; Use the MONNAME3 format to get first three characters of the month name.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; newdir=dcreate(&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;catx('-'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; , put(month(today()),z2.)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; , put(month(today()), monname3.)||''||put(year(today()),4.)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; , 'C:\AB&amp;amp;C\Reports &amp;amp; Tests\');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 20:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42276#M10965</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-02-02T20:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42277#M10966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just change the '-' to ' - '.&amp;nbsp; e.g.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newdir=dcreate(catx(' - ', month(today()), &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put(today(), monyy7.)),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'C:\AB&amp;amp;C\Reports &amp;amp; Tests\');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 20:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42277#M10966</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-02T20:11:09Z</dc:date>
    </item>
    <item>
      <title>Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42278#M10967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tried the code and it created the space but now the month name is wrong... so it outputs : 02 - Jan - 2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another Question : How do I make this code create a folder for the previous month. So if I run this in Feburary it creates a folder named : 01 - Jan 2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 20:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42278#M10967</guid>
      <dc:creator>vomer</dc:creator>
      <dc:date>2012-02-02T20:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42279#M10968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #eef4f9; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;Tried the code and&lt;STRONG&gt; it created the space but now the month name is wrong&lt;/STRONG&gt;... so it outputs : 02 - Jan - 2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #eef4f9; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;Code Used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; newdir=dcreate(&lt;/P&gt;&lt;P&gt;catx(' - '&lt;/P&gt;&lt;P&gt;, put(month(today()),z2.)&lt;/P&gt;&lt;P&gt;, put(month(today()), monname3.)||''||put(year(today()),4.)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;, 'U:\Software\');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #eef4f9;"&gt;Another Question : How do I make this code create a folder for the previous month. So if I run this in Feburary it creates a folder named : 01 - Jan 2012&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #eef4f9; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"&gt;Many Thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 21:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42279#M10968</guid>
      <dc:creator>vomer</dc:creator>
      <dc:date>2012-02-02T21:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42280#M10969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take out the second MONTH() function, MONNAME format applies to real date, not a month number. It was getting the month for 02JAN1960.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To figure out what date it was last month use the INTNX function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 21:12:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42280#M10969</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-02-02T21:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42281#M10970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry I am a bit confused... taking it out caused an error...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also where/how does the INTNX go? Could you please provide the code.. sorry I am very new to SAS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 21:21:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42281#M10970</guid>
      <dc:creator>vomer</dc:creator>
      <dc:date>2012-02-02T21:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42282#M10971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This will get todays date. Get a date in the previous month.&amp;nbsp; Build the directory names into variables. Then call the DCREATE() function to make the directories.&lt;/P&gt;&lt;P&gt;I put the parent directory into a variable so that I can use it two places without having to type it twice.&lt;/P&gt;&lt;P&gt;The PUT statement will let you see the directory names that it generated and the result of the DCREATE function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rootdir='U:\Software\';&lt;/P&gt;&lt;P&gt;&amp;nbsp; today=today();&lt;/P&gt;&lt;P&gt;&amp;nbsp; lastmonth=intnx('month',today,-1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; dir1=catx(' ',put(month(lastmonth),z2.),'-',put(lastmonth,monname3.),year(lastmonth));&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: monospace; white-space: pre; background-color: #ffffff;"&gt;&amp;nbsp; dir2=catx(' ',put(month(today),z2.),'-',put(today,monname3.),year(today));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'courier new', courier; background-color: #ffffff;"&gt; newdir1=dcreate(dir1,rootdir&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'courier new', courier;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'courier new', courier;"&gt;&amp;nbsp; newdir2=dcreate(dir2,rootdir);&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; font-family: 'courier new', courier;"&gt;&amp;nbsp; put (rootdir dir1 newdir1 dir2 newdir2) (=/);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 22:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42282#M10971</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-02-02T22:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42283#M10972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom, that is amazing! I wil give this a try soon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One final question (I promise) : After the directory (01 - Jan 2012) is made using the script your provided, is there any way I can also add a sub-directory under the newly created 01 - Jan 2012 folder?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used an "x" command but it did not work and got stuck on the command line window. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 23:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42283#M10972</guid>
      <dc:creator>vomer</dc:creator>
      <dc:date>2012-02-02T23:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic Directory Creation - Windows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42284#M10973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried Tom's code. It works great! I was able to create a sub_directory "test" under the newly created "01 -jan 2012 "folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rootdir='c:\temp\';&lt;/P&gt;&lt;P&gt;&amp;nbsp; today=today();&lt;/P&gt;&lt;P&gt;&amp;nbsp; lastmonth=intnx('month',today,-1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; dir1=catx(' ',put(month(lastmonth),z2.),'-',put(lastmonth,monname3.),year(lastmonth));&lt;/P&gt;&lt;P&gt;&amp;nbsp; dir2=catx(' ',put(month(today),z2.),'-',put(today,monname3.),year(today));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; dir3='test'; /* Iadded */&lt;/P&gt;&lt;P&gt;&amp;nbsp; newdir1=dcreate(dir1,rootdir);&lt;/P&gt;&lt;P&gt;&amp;nbsp; newdir3=dcreate(dir3,newdir1); /* i added*/&lt;/P&gt;&lt;P&gt;&amp;nbsp; newdir2=dcreate(dir2,rootdir);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put (rootdir dir1 newdir1 dir2 newdir2 dir3 newdir3) (=/);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from log file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rootdir=c:\temp\&lt;/P&gt;&lt;P&gt;dir1=01 - Jan 2012&lt;/P&gt;&lt;P&gt;newdir1=c:\temp\01 - Jan 2012&lt;/P&gt;&lt;P&gt;dir2=02 - Feb 2012&lt;/P&gt;&lt;P&gt;newdir2=c:\temp\02 - Feb 2012&lt;/P&gt;&lt;P&gt;dir3=test&lt;/P&gt;&lt;P&gt;newdir3=c:\temp\01 - Jan 2012\test&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.03 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Linlin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Feb 2012 01:10:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Automatic-Directory-Creation-Windows/m-p/42284#M10973</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-02-03T01:10:43Z</dc:date>
    </item>
  </channel>
</rss>

