<?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: Create a folder and a subfolder in one string in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Create-a-folder-and-a-subfolder-in-one-string/m-p/853931#M37577</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;how should the code look like if there was &lt;EM&gt;n&lt;/EM&gt; subfolders in &lt;EM&gt;k&lt;/EM&gt;?&lt;/P&gt;</description>
    <pubDate>Sun, 15 Jan 2023 17:33:40 GMT</pubDate>
    <dc:creator>cleokatt</dc:creator>
    <dc:date>2023-01-15T17:33:40Z</dc:date>
    <item>
      <title>Create a folder and a subfolder in one string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-folder-and-a-subfolder-in-one-string/m-p/853408#M37548</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;BR /&gt;I'm trying to make SAS to create a folder when running a code and that's just:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let year = 2022;

options dlcreatedir;

libname out "mypath\&amp;amp;year";&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and it works fine &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;BR /&gt;but I also want SAS to create a subfolder in the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;&amp;amp;year&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;-folder called 'data' and I thought I just could add:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let year = 2022;

options dlcreatedir;

libname out "mypath\&amp;amp;year\DATA";&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But it dosen't work that way. I was thinking maybe do the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;options dlcreatedir;

libname out&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;twice. (like create the first folder, and then do the dlcreatedir once again, but I have a &amp;amp;year-macro variable so it dosen't make a good fit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone who can help me? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 09:05:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-folder-and-a-subfolder-in-one-string/m-p/853408#M37548</guid>
      <dc:creator>cleokatt</dc:creator>
      <dc:date>2023-01-12T09:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create a folder and a subfolder in one string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-folder-and-a-subfolder-in-one-string/m-p/853412#M37549</link>
      <description>&lt;P&gt;Using DLCREATEDIR allows you to create a folder under an existing parent folder.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code you've posted looks right and it's something that I've done already many times without ever having issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below code will work if the absolute path d:\mypath already exists&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let year = 2022;
options dlcreatedir;
libname out "d:\mypath\&amp;amp;year";
libname out "d:\mypath\&amp;amp;year\data";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jan 2023 10:37:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-folder-and-a-subfolder-in-one-string/m-p/853412#M37549</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-01-12T10:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create a folder and a subfolder in one string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-folder-and-a-subfolder-in-one-string/m-p/853424#M37550</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
Try function DCREATE()
--DCREATE(directory-name&amp;lt;,parent-directory&amp;gt;)
*/

%let year = 2022;

data _null_;
 new=dcreate("&amp;amp;year",'c:\temp\');
 new=dcreate("data",new);
 put new= ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jan 2023 11:35:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-folder-and-a-subfolder-in-one-string/m-p/853424#M37550</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-01-12T11:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create a folder and a subfolder in one string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-folder-and-a-subfolder-in-one-string/m-p/853931#M37577</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;how should the code look like if there was &lt;EM&gt;n&lt;/EM&gt; subfolders in &lt;EM&gt;k&lt;/EM&gt;?&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jan 2023 17:33:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-folder-and-a-subfolder-in-one-string/m-p/853931#M37577</guid>
      <dc:creator>cleokatt</dc:creator>
      <dc:date>2023-01-15T17:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create a folder and a subfolder in one string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-folder-and-a-subfolder-in-one-string/m-p/853973#M37585</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
You should use N time for  DCREATE()
The following code would creata a path:
c:\temp\2022\data1\data2\data3\data4
*/

%let year = 2022;

data _null_;
 new=dcreate("&amp;amp;year",'c:\temp\');
 new=dcreate("data1",new);
 new=dcreate("data2",new);
 new=dcreate("data3",new);
 new=dcreate("data4",new);
 put new= ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Jan 2023 11:58:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-folder-and-a-subfolder-in-one-string/m-p/853973#M37585</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-01-16T11:58:28Z</dc:date>
    </item>
  </channel>
</rss>

