<?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: Dynamically changing tmp table names in SAS EG Large Process flow in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859484#M42309</link>
    <description>&lt;P&gt;&lt;SPAN&gt;tmp7day is as SAS libref that needs to be defined somewhere. It's either in code, in SAS metadata or in an autoexec. Try to find it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;A libref points to some physical location. My line of thought is to change the library definition so the path it points to is user specific.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Ideally you can change the libname definition in a central place. If that's not possible then something like below could also work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's say the existing libref points to c:\temp&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname tmp7day "c:\temp";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could as first step in your EG project re-point this library to a user specific folder. Code like below should work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options dlcreatedir;
libname tmp7day "%sysfunc(pathname(tmp7day))\&amp;amp;sysuserid";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Just make sure to not execute above code more than once in an EG session or build some additional logic to prevent this libname to execute more than once in a SAS session. Code like below could do this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let sv_dlcreatedir=%sysfunc(getoption(dlcreatedir));
options dlcreatedir;
data _null_;
  if find(pathname('tmp7day'),"&amp;amp;sysuserid",'i') &amp;lt;=0 then
    do;
      rc=libname('tmp7day',catx('\',pathname('tmp7day'),"&amp;amp;sysuserid"));
    end;
run;
options &amp;amp;sv_dlcreatedir;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;40         libname tmp7day list;
NOTE: Libref=   TMP7DAY 
      .......
      Filename= c:\temp\&amp;lt;and here the userid of the user that executes the script&amp;gt;
      .......&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if these tmp tables really only need to exist during a SAS session then re-point libref tmp7day to the SAS WORK library.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SAS WORK library gets automatically created during SAS invocation and it points to a session specific folder location that gets created when SAS starts and that gets removed when SAS terminates.&lt;/P&gt;
&lt;P&gt;Code like below would allow you to define an additional libref that also points to this WORK location.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname tmp7day "%sysfunc(pathname(work))";&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 18 Feb 2023 00:03:45 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2023-02-18T00:03:45Z</dc:date>
    <item>
      <title>Dynamically changing tmp table names in SAS EG Large Process flow</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859207#M42278</link>
      <description>&lt;P&gt;I recently joined a team that has templates built for 20+ different SAS process flows.&amp;nbsp; It looks like the original template was built yrs ago and Saved As a new template for each line of business we work with. Each model may look slightly different based on the LOB we are working with. The problem is when the original was built it wrote data to tmp tables on the server, each model uses the same data output and they are all named the same.&amp;nbsp; So if 2 people are running different templates, because the data output saved on the tmp tables is the same name, the runs overwrite each other. I've updated any program in the process flow to include a %LET to establish a prefix that appends to each of the tmp tables that are created which should work fine.&amp;nbsp; My challenge now is that each query needs (50+) to be manually updated to include the new prefix, then I run the query to create a new data output, delete that output, then change the current data output properties to point to the new data output I just created.&amp;nbsp; This takes hours to update and we have 20+ templates that need changes made to avoid conflict of overwriting tmp tables.&amp;nbsp; Any suggestions would be appreciated to reduce the manual effort needed.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 15:22:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859207#M42278</guid>
      <dc:creator>beamer108</dc:creator>
      <dc:date>2023-02-16T15:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing tmp table names in SAS EG Large Process flow</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859258#M42283</link>
      <description>&lt;P&gt;What about switching these tables to SAS WORK tables? Then you can keep the same name for all of them as they will be written to each user's separate WORK library.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 19:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859258#M42283</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-02-16T19:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing tmp table names in SAS EG Large Process flow</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859265#M42284</link>
      <description>&lt;P&gt;How long does the data stay in WORK tables?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 21:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859265#M42284</guid>
      <dc:creator>beamer108</dc:creator>
      <dc:date>2023-02-16T21:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing tmp table names in SAS EG Large Process flow</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859273#M42288</link>
      <description>&lt;P&gt;For the duration of the EG session.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 21:55:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859273#M42288</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-02-16T21:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing tmp table names in SAS EG Large Process flow</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859358#M42295</link>
      <description>&lt;P&gt;Is there an easy way to change all the table names to 'work' or do I need to manually go into each of the queries and programs? This one process flow I am testing has 58 queries and progames&amp;nbsp; and we have 28 different process flows that the changes will need to be made in.&amp;nbsp; &amp;nbsp;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 12:37:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859358#M42295</guid>
      <dc:creator>beamer108</dc:creator>
      <dc:date>2023-02-17T12:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing tmp table names in SAS EG Large Process flow</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859369#M42296</link>
      <description>&lt;P&gt;What do you mean by "&lt;SPAN&gt;it wrote data to tmp tables on the server"?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Normally SAS tables are two level &amp;lt;libref&amp;gt;.&amp;lt;table name&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;lt;libref&amp;gt; can be WORK which is SAS session specific and though user will never collide.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Else I'd expect there is some libname that creates the libref for your "tmp" table - and if so then it's eventually possible to create user or even session specific paths during runtime - and though also these paths would become user or even session specific.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Is there somewhere a libname for these tmp tables? Where is it (in code, metadata or autoexec)?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 12:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859369#M42296</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-02-17T12:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing tmp table names in SAS EG Large Process flow</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859370#M42297</link>
      <description>I mean to say that when the flow runs it creates tmp tables that are referenced in other steps. The problem is that the temporary table names are not unique so if I run a process flow its creating tmp7day.000_ABC, if my teammate runs a diff process flow that also creates tmp7day.000_ABC theirs will overwrite mine. I did a search in the process flow to look for libname and I don't see where there is a libname for tmp tables.</description>
      <pubDate>Fri, 17 Feb 2023 13:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859370#M42297</guid>
      <dc:creator>beamer108</dc:creator>
      <dc:date>2023-02-17T13:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing tmp table names in SAS EG Large Process flow</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859484#M42309</link>
      <description>&lt;P&gt;&lt;SPAN&gt;tmp7day is as SAS libref that needs to be defined somewhere. It's either in code, in SAS metadata or in an autoexec. Try to find it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;A libref points to some physical location. My line of thought is to change the library definition so the path it points to is user specific.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Ideally you can change the libname definition in a central place. If that's not possible then something like below could also work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's say the existing libref points to c:\temp&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname tmp7day "c:\temp";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could as first step in your EG project re-point this library to a user specific folder. Code like below should work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options dlcreatedir;
libname tmp7day "%sysfunc(pathname(tmp7day))\&amp;amp;sysuserid";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Just make sure to not execute above code more than once in an EG session or build some additional logic to prevent this libname to execute more than once in a SAS session. Code like below could do this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let sv_dlcreatedir=%sysfunc(getoption(dlcreatedir));
options dlcreatedir;
data _null_;
  if find(pathname('tmp7day'),"&amp;amp;sysuserid",'i') &amp;lt;=0 then
    do;
      rc=libname('tmp7day',catx('\',pathname('tmp7day'),"&amp;amp;sysuserid"));
    end;
run;
options &amp;amp;sv_dlcreatedir;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;40         libname tmp7day list;
NOTE: Libref=   TMP7DAY 
      .......
      Filename= c:\temp\&amp;lt;and here the userid of the user that executes the script&amp;gt;
      .......&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if these tmp tables really only need to exist during a SAS session then re-point libref tmp7day to the SAS WORK library.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SAS WORK library gets automatically created during SAS invocation and it points to a session specific folder location that gets created when SAS starts and that gets removed when SAS terminates.&lt;/P&gt;
&lt;P&gt;Code like below would allow you to define an additional libref that also points to this WORK location.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname tmp7day "%sysfunc(pathname(work))";&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Feb 2023 00:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/859484#M42309</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-02-18T00:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing tmp table names in SAS EG Large Process flow</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/860180#M42341</link>
      <description>&lt;P&gt;Thank you for that suggestion - I am working with my sas admins to get this set up. The only last challenge we foresee is that when when&lt;SPAN&gt;&lt;SPAN class="ui-provider wh b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak"&gt;&amp;nbsp;SAS EG loses the connection to the SAS Compute server (say we are waiting for long running query or get pulled away) and then is automatically restored, the libref to tmpNday disk gets reset to the default so you will have to rerun the code to remap them.&amp;nbsp; The loss of connection isn't that obvious, it only appears in a warning box alert at the top of our eg session but itsn't that noticeable, so if you walk away while a process is running and don't realize your connection was lost during that time, we are now writing to the default tmpnday. Any suggestions or ideas would be appreciated.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 14:34:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/860180#M42341</guid>
      <dc:creator>beamer108</dc:creator>
      <dc:date>2023-02-22T14:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing tmp table names in SAS EG Large Process flow</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/860305#M42346</link>
      <description>&lt;P&gt;If reliability is an issue for you running long jobs via EG, then consider switching to server-based job scheduling - it's way more reliable. We don't use EG for any regular long-running jobs, we switch to server-based scheduling using SAS Management Console, a point-and-click interface for (amongst other things) scheduling and running regular jobs in batch mode. You will have to export your EG projects to SAS programs to do this however. Your SAS admins should know all about this.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 20:53:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/860305#M42346</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-02-22T20:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing tmp table names in SAS EG Large Process flow</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/860321#M42347</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/123249"&gt;@beamer108&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I mean to say that when the flow runs it creates tmp tables that are referenced in other steps. The problem is that the temporary table names are not unique so if I run a process flow its creating tmp7day.000_ABC, if my teammate runs a diff process flow that also creates tmp7day.000_ABC theirs will overwrite mine. I did a search in the process flow to look for libname and I don't see where there is a libname for tmp tables.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So it looks like everyone is defining TMP7DAY to point to the same location.&lt;/P&gt;
&lt;P&gt;If you point it to a different location for each user you can reduce the risk of conflict to just conflicts with yourself.&amp;nbsp; (Which is NOT a trivial risk for normal SAS usage. I frequently run many many many SAS jobs at the same time, but for something being run interactively with Enterprise Guide the risk is probably smaller.)&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 23:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/860321#M42347</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-02-22T23:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing tmp table names in SAS EG Large Process flow</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/860422#M42355</link>
      <description>&lt;P&gt;Thank you to everyone for the suggestions and support.&amp;nbsp; We have a process in place and are testing it now.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 12:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Dynamically-changing-tmp-table-names-in-SAS-EG-Large-Process/m-p/860422#M42355</guid>
      <dc:creator>beamer108</dc:creator>
      <dc:date>2023-02-23T12:09:14Z</dc:date>
    </item>
  </channel>
</rss>

