<?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: Creating subfolders and libnames in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157458#M30729</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear mcrum1,&lt;/P&gt;&lt;P&gt;Are you certain that you can create folders in the directory C:\Users\person1\Documents\?&amp;nbsp; If you can, all of the previous suggestions should work.&amp;nbsp; If you can manually create the new directories in the documents folder, then the problem is surmountable by any of the prior suggestions, if you are not restricted by your site administrator.&amp;nbsp; If you can manually create the new directories, please send your error logs for any of the prior suggestions. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jun 2014 15:23:18 GMT</pubDate>
    <dc:creator>jwillis</dc:creator>
    <dc:date>2014-06-04T15:23:18Z</dc:date>
    <item>
      <title>Creating subfolders and libnames</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157450#M30721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello! I’m still learning SAS so hopefully my question is coming out clearly.&amp;nbsp; I’m trying to automatically update the libname and/or automatically create sub folders for a program if the same program is ran multiple times during the same month. I tried to make the libname a macro variable, but it gives me an error.&amp;nbsp; &lt;/P&gt;&lt;P&gt;This is what I have so far.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 9pt;"&gt;options&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 9pt;"&gt;dlcreatedir&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 9pt;"&gt;LIBNAME&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt; Run1 ( &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 9pt;"&gt;"C:\Users\person1\Documents\201405\run1"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 9pt;"&gt;"C:\Users\person1\Documents\&amp;amp;YR_MNTH\run2"&lt;/SPAN&gt;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 9pt;"&gt;"C:\Users\person1\Documents\&amp;amp;YR_MNTH\run3"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 9pt;"&gt;libname&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt; Run1 &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 9pt;"&gt;clear&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I would like it to create automatically or something along the lines. I’m just not sure how to get there without the errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Day 1 (first time I run the program):&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 9pt;"&gt;LIBNAME&lt;/SPAN&gt;&amp;nbsp; Run1: &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 9pt;"&gt;"C:\Users\person1\Documents\&amp;amp;YR_MNTH\run1"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Day 2 (second time I run the program):&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 9pt;"&gt;LIBNAME&lt;/SPAN&gt;&amp;nbsp; Run2: &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 9pt;"&gt;"C:\Users\person1\Documents\&amp;amp;YR_MNTH\run2"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Day 2 (third time I run the program):&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 9pt;"&gt;LIBNAME&lt;/SPAN&gt;&amp;nbsp; Run3: &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 9pt;"&gt;"C:\Users\person1\Documents\&amp;amp;YR_MNTH\run3"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone has any advice please let me know. Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 17:45:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157450#M30721</guid>
      <dc:creator>mcrum1</dc:creator>
      <dc:date>2014-05-13T17:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subfolders and libnames</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157451#M30722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the directories do not exist before the libname statement is run then you will get an error. Libname doesn't create a folder/directory.&lt;/P&gt;&lt;P&gt;Look at the documentation for DCREATE for on possible way to create folders.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 17:55:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157451#M30722</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-05-13T17:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subfolders and libnames</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157452#M30723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With LIBNAME and DLCREATEDIR you can only create one new sub-level at a time.&amp;nbsp; So create &amp;amp;YR_MNTH first then run1 run2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 18:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157452#M30723</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-05-13T18:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subfolders and libnames</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157453#M30724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add a X statement before libname statement to execute a OS command if you have right to execute PIPE command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;options noxwait;
%let n=%sysevalf(%sysfunc(ranuni(0))*10000,i);
x "mkdir c:\temp\run&amp;amp;n";
libname x v9 "c:\temp\run&amp;amp;n";


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 14:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157453#M30724</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-05-14T14:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subfolders and libnames</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157454#M30725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't believe I have rights for this command. I get the error "Shell escape is not valid in this SAS session".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 14:24:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157454#M30725</guid>
      <dc:creator>mcrum1</dc:creator>
      <dc:date>2014-06-04T14:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subfolders and libnames</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157455#M30726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don't have rights to the X command, this is worth a try instead:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%sysexec mkdir c:\temp\run&amp;amp;n;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No guarantees, but it might sneak through.&amp;nbsp; You don't need the quotes when switching to %sysexec.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 14:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157455#M30726</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-06-04T14:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subfolders and libnames</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157456#M30727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Personally I would investigate version control.&amp;nbsp; What you are talking about is keeping a snapshot at certain timepoints.&amp;nbsp; TortoiseSVN for example is free and relatively simple.&amp;nbsp; You would have one copy of the run, and utilizing the version control system that would keep your snapshots.&amp;nbsp; I have worked at a company which had this type of Run 1, dated folders structure and it really is a complete nightmare when working with more than just yourself.&amp;nbsp; The other reason is why keep multiple copies of the same thing, just let a DB backend like SVN keep differences between versions, reduces the size of these things greatly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 14:59:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157456#M30727</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-06-04T14:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subfolders and libnames</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157457#M30728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Astounding,&lt;/P&gt;&lt;P&gt;I don't think that could work. use DCREATE () instead .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;%let n=%sysfunc(translate(%sysfunc(datetime(),datetime.),_,:));
data _null_;
 rc=dcreate("run&amp;amp;n",'c:\temp\');
run;

libname x v9 "c:\temp\run&amp;amp;n";

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 15:02:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157457#M30728</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-06-04T15:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating subfolders and libnames</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157458#M30729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear mcrum1,&lt;/P&gt;&lt;P&gt;Are you certain that you can create folders in the directory C:\Users\person1\Documents\?&amp;nbsp; If you can, all of the previous suggestions should work.&amp;nbsp; If you can manually create the new directories in the documents folder, then the problem is surmountable by any of the prior suggestions, if you are not restricted by your site administrator.&amp;nbsp; If you can manually create the new directories, please send your error logs for any of the prior suggestions. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 15:23:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-subfolders-and-libnames/m-p/157458#M30729</guid>
      <dc:creator>jwillis</dc:creator>
      <dc:date>2014-06-04T15:23:18Z</dc:date>
    </item>
  </channel>
</rss>

