<?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: Will a DCREATE'd folder under WORK be removed when the session ends? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957520#M373779</link>
    <description>I'm running code in a balanced server environment, so different SAS sessions can end up on different hosts and becomes more time consuming.</description>
    <pubDate>Tue, 28 Jan 2025 22:35:45 GMT</pubDate>
    <dc:creator>RichardAD</dc:creator>
    <dc:date>2025-01-28T22:35:45Z</dc:date>
    <item>
      <title>Will a DCREATE'd folder under WORK be removed when the session ends?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957325#M373720</link>
      <description>&lt;P&gt;I've done the following on my own system without seeming problems.&amp;nbsp; I can't recall when I verified it.&amp;nbsp; Similar code is going to be to run in a server environment and I don't have access to system commands to verify.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;session starts&amp;gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* set up a temporary (work) folder isolated from the main work folder */

%let path = %sysfunc(DCREATE(isolate,%sysfunc(pathname(WORK)))) ;
%let isolate = %sysfunc(pathname(WORK))/isolate ;  /* dont use &amp;amp;path in case code is rerun in session... */

libname ISOLATE "&amp;amp;isolate" ;

/* create stuff in ISOLATE ;
 * create stuff in WORK ;
 * compare, contrast and twiddle data betwixt the two ;
 */

libname ISOLATE ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;lt;session ends&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will SAS remove the .../isolate sub-folder as well as every file in the then work folder?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 18:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957325#M373720</guid>
      <dc:creator>RichardAD</dc:creator>
      <dc:date>2025-01-27T18:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Will a DCREATE'd folder under WORK be removed when the session ends?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957328#M373722</link>
      <description>&lt;P&gt;I don't really know the answer, but YOU could try it yourself and find out the answer in seconds! Please let us all know what the answer is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_self"&gt;Maxim 4&lt;/A&gt;:&amp;nbsp;If in doubt, do a test run and look at the results.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 19:15:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957328#M373722</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-01-27T19:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: Will a DCREATE'd folder under WORK be removed when the session ends?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957335#M373723</link>
      <description>&lt;P&gt;In general yes.&amp;nbsp; At least it has in every installation I have used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could try it yourself.&amp;nbsp; Run your program, make sure the actual path is printed into the SAS log, and then check if the folder is gone after the job ends.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note there is a SAS option to disable the automatic removal of the WORK directory.&amp;nbsp; So make sure you don't have that option set.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 19:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957335#M373723</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-01-27T19:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Will a DCREATE'd folder under WORK be removed when the session ends?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957337#M373725</link>
      <description>&lt;P&gt;It did for me with a manually-created folder done via Windows Explorer. I don't think a DCREATE'd folder would behave any differently.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 19:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957337#M373725</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2025-01-27T19:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Will a DCREATE'd folder under WORK be removed when the session ends?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957371#M373739</link>
      <description>&lt;P&gt;I've used this approach in various environments over the years and never observed any issues. Based on experience I'd say that when SAS terminates a session it always removes the work folder and all its content irrespective of its content.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 21:44:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957371#M373739</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2025-01-27T21:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Will a DCREATE'd folder under WORK be removed when the session ends?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957470#M373768</link>
      <description>&lt;P&gt;I rely on this behavior all of the time when I use DLCREATDIR and LIBNAME to make temp folders, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;options dlcreatedir;
%let repopath=%sysfunc(getoption(WORK))/wordle-sas;
libname repo "&amp;amp;repopath.";
data _null_;
    rc = gitfn_clone( 
      "https://github.com/sascommunities/wordle-sas", 
      "&amp;amp;repoPath." 
    ); 
    put 'Git repo cloned ' rc=; 
run;
%include "&amp;amp;repopath./wordle-sas.sas";
 
/* start a game and submit first guess */
%startGame;
%guess(adieu);&lt;/LI-CODE&gt;
&lt;P&gt;One cool thing about this technique is that you can use a concatenated LIBNAME to create multiple folders.&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;options dlcreatedir;
%let outdir=%sysfunc(getoption(WORK));
libname res ("&amp;amp;outdir./results", "&amp;amp;outdir./results/images");
libname res clear;&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Jan 2025 16:13:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957470#M373768</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2025-01-28T16:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Will a DCREATE'd folder under WORK be removed when the session ends?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957520#M373779</link>
      <description>I'm running code in a balanced server environment, so different SAS sessions can end up on different hosts and becomes more time consuming.</description>
      <pubDate>Tue, 28 Jan 2025 22:35:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Will-a-DCREATE-d-folder-under-WORK-be-removed-when-the-session/m-p/957520#M373779</guid>
      <dc:creator>RichardAD</dc:creator>
      <dc:date>2025-01-28T22:35:45Z</dc:date>
    </item>
  </channel>
</rss>

