<?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: Promote a session scope CAS table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-CAS-table/m-p/756186#M238705</link>
    <description>&lt;P&gt;To promote an existing session-scoped in-memory CAS table you need to run the promote action within the same CAS session in which the session-scoped table exists.&amp;nbsp; In this case you are creating a new session and running with that new session so the promote cannot see the session-scoped table (which is in a different session).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the CAS session in which you loaded the session-scoped table is still active then you can obtain its CAS session ID and use that to connect your code to the same session.&amp;nbsp; Refer to:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/casref/n0z3r80fjqpobvn1lvegno9gefni.htm#p1fzayvgmpow0mn1ivop3pqakrx5" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/casref/n0z3r80fjqpobvn1lvegno9gefni.htm#p1fzayvgmpow0mn1ivop3pqakrx5&lt;/A&gt;&amp;nbsp;and "Example 8: Connect to an Existing Session".&amp;nbsp; You would want to do something along the lines of:&lt;BR /&gt;cas mysess uuid="ca683ddf-fe18-3c48-a04e-45718220976d";&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the CAS session where you loaded the session-scoped table is no longer active, then your session-scoped table will have been unloaded from memory at the time the CAS session was terminated.&amp;nbsp; In that case, you may want to combine your code that loads the session-scoped table (which I don't see here) and your code that promotes the table into the same snippet/program as that will have both the loadTable and the promote running in the same CAS session.&amp;nbsp; Thus there will be no issue with the promote locating your session-scoped in-memory table.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jul 2021 13:32:39 GMT</pubDate>
    <dc:creator>BenRyan</dc:creator>
    <dc:date>2021-07-23T13:32:39Z</dc:date>
    <item>
      <title>Promote a session scope CAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-CAS-table/m-p/755814#M238576</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to promote a session scope CAS table. The table needs to be global scope but in CAS only. Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cas Public sessopts=(caslib='Public' timeout=1800 locale="en_US");&lt;/P&gt;&lt;P&gt;/* Create SAS librefs for existing caslibs so that they are visible in the SAS Studio Libraries tree. */&lt;BR /&gt;/* Recommend to use the 'Public' as the libname */&lt;/P&gt;&lt;P&gt;libname Public cas caslib ='Public';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC CASUTIL;&lt;BR /&gt;&amp;nbsp;droptable casdata='GL_PERIODS_inCas' incaslib="Public" quiet;&amp;nbsp;&lt;BR /&gt;promote casdata='GL_PERIODS' incaslib="PUBLIC" casout = 'GL_PERIODS_inCas' outcaslib="PUBLIC";&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above code generates the following error:&lt;/P&gt;&lt;DIV class="sasError"&gt;ERROR: There is no session-scope table GL_PERIODS in caslib Public of Cloud Analytic Services.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: The action stopped due to errors.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;Please let me know what would be the fix. Much Thanks!&lt;/DIV&gt;&lt;PRE class="sasLog"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 01:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-CAS-table/m-p/755814#M238576</guid>
      <dc:creator>sujaybshha</dc:creator>
      <dc:date>2021-07-22T01:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Promote a session scope CAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-CAS-table/m-p/755924#M238592</link>
      <description>&lt;P&gt;Assuming you have the requisite permissions to promote &amp;amp; delete tables, here is the trouble as I see it:&lt;BR /&gt;After your DROPTABLE statement deletes the table named&amp;nbsp;&lt;STRONG&gt;GL_PERIODS_inCAS&lt;/STRONG&gt;, the CAS table you want to put in its place (&lt;STRONG&gt;GL_PERIODS&lt;/STRONG&gt;)&amp;nbsp;doesn't yet exist. This is what is causing the error message:&amp;nbsp;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#FF0000"&gt;ERROR: There is no session-scope table GL_PERIODS in caslib Public of Cloud Analytic Services.&lt;/FONT&gt;&lt;BR /&gt;You need to create a session-scope table named &lt;STRONG&gt;GL_PERIODS&lt;/STRONG&gt; in the &lt;STRONG&gt;Public&lt;/STRONG&gt; caslib before you begin this process.&amp;nbsp;Once you have the session-scoped table available in &lt;STRONG&gt;Public&lt;/STRONG&gt;, you can more easily&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;accomplish your goal using CASL code (instead of PROC CASUTIL). Something like this should work:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc cas;
table.dropTable /
   caslib="public"
  ,name="GL_PERIODS_inCAS"
  ,quiet=TRUE
;
/* For Viya 3.4 and 3.5, use table.partition to copy the table */
table.partition /
   table={caslib="public",name="GL_PERIODS"}
  ,casout={caslib="public",name="GL_PERIODS_inCAS",promote=TRUE}

;
/* For Viya 2020.1 and beyond, use table.copyTable */
table.copyTable /
   table={caslib="public",name="GL_PERIODS"}
  ,casout={caslib="public",name="GL_PERIODS_inCAS",promote=TRUE}

;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;After verifying that all went well, you can drop the session-scoped table, or just disconnect from CAS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May the SAS be with you!&lt;BR /&gt;Mark&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 12:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-CAS-table/m-p/755924#M238592</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2021-07-22T12:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Promote a session scope CAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-CAS-table/m-p/756186#M238705</link>
      <description>&lt;P&gt;To promote an existing session-scoped in-memory CAS table you need to run the promote action within the same CAS session in which the session-scoped table exists.&amp;nbsp; In this case you are creating a new session and running with that new session so the promote cannot see the session-scoped table (which is in a different session).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the CAS session in which you loaded the session-scoped table is still active then you can obtain its CAS session ID and use that to connect your code to the same session.&amp;nbsp; Refer to:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/casref/n0z3r80fjqpobvn1lvegno9gefni.htm#p1fzayvgmpow0mn1ivop3pqakrx5" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/casref/n0z3r80fjqpobvn1lvegno9gefni.htm#p1fzayvgmpow0mn1ivop3pqakrx5&lt;/A&gt;&amp;nbsp;and "Example 8: Connect to an Existing Session".&amp;nbsp; You would want to do something along the lines of:&lt;BR /&gt;cas mysess uuid="ca683ddf-fe18-3c48-a04e-45718220976d";&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the CAS session where you loaded the session-scoped table is no longer active, then your session-scoped table will have been unloaded from memory at the time the CAS session was terminated.&amp;nbsp; In that case, you may want to combine your code that loads the session-scoped table (which I don't see here) and your code that promotes the table into the same snippet/program as that will have both the loadTable and the promote running in the same CAS session.&amp;nbsp; Thus there will be no issue with the promote locating your session-scoped in-memory table.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 13:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-CAS-table/m-p/756186#M238705</guid>
      <dc:creator>BenRyan</dc:creator>
      <dc:date>2021-07-23T13:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Promote a session scope CAS table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-CAS-table/m-p/756301#M238743</link>
      <description>&lt;P&gt;Thanks, I am using Viya 3.5, so table.partition is the command I was looking for.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 19:20:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-CAS-table/m-p/756301#M238743</guid>
      <dc:creator>sujaybshha</dc:creator>
      <dc:date>2021-07-23T19:20:31Z</dc:date>
    </item>
  </channel>
</rss>

