<?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 table to global scope in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/883613#M349109</link>
    <description>&lt;P&gt;I could use some clarification here. What is the goal? Do you want to &lt;EM&gt;drop&lt;/EM&gt; &lt;EM&gt;all copies of the tables listed&lt;/EM&gt; (that is, both session-scoped and global-scoped copies of a table - as seems to be indicated by your most recent entry above) or do you want to &lt;EM&gt;promote all listed tables and ensure only the promoted copy remains (&lt;/EM&gt;as indicated by&amp;nbsp;your original framing of the problem)? If the original interpretation of the problem was correct, what in the provided solution isn't working for you?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jul 2023 17:58:07 GMT</pubDate>
    <dc:creator>SASJedi</dc:creator>
    <dc:date>2023-07-05T17:58:07Z</dc:date>
    <item>
      <title>Promote a session scope table to global scope</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/882976#M348888</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As result of a cas action set, I have a set of tables as output (saved in the GMS caslib) which I want promote to global level: If I perform the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%macro promoting;

%do o=1 %to 6;

proc casutil;
promote casdata="gms.&amp;amp;&amp;amp;table&amp;amp;o" 
Incaslib="Global Marketing (DNFS)"
outcaslib="Global Marketing (DNFS)";
run;



%end;


%mend promoting;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm getting error that exists already a table with those names (despite not promoted), so I can't perform the promotion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked documentation and this seems should be the way to approach the promotion. Any idea about the failures?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 16:42:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/882976#M348888</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2023-06-29T16:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Promote a session scope table to global scope</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/882981#M348893</link>
      <description>&lt;P&gt;If I was doing this job, I'd use CASL and CAS actions. For example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create some session-scoped tables in a global-scoped caslib */
proc casutil;
	load data=sashelp.cars casout="cars1" outcaslib="casuser" replace;
	load data=sashelp.cars casout="cars2" outcaslib="casuser" replace;
	load data=sashelp.cars casout="cars3" outcaslib="casuser" replace;
	load data=sashelp.cars casout="cars4" outcaslib="casuser" replace;
	load data=sashelp.cars casout="cars5" outcaslib="casuser" replace;
run; quit;


proc cas;
/* Use table.tableInfo to get a list of the tables in the specified caslib */
table.tableInfo result=r/
	caslib="casuser";

/* Extract just the table names to a CASL array */
tableList=r.tableInfo[,1];

/* Use a CASL DO OVER loop to execute table.promote for each table in the array */
do thisTable over tableList;
	table.promote /
		 caslib="casuser"
		,name=thisTable
		/* DROP=TRUE gets rid of the session table creating the globla table */
		,drop=TRUE
	;
end;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and here's the applicable notes from the log:&lt;/P&gt;
&lt;PRE&gt;NOTE: Cloud Analytic Services promoted table CARS1 in caslib CASUSER(myUserID) to table CARS1 in caslib 
      CASUSER(myUserID).
NOTE: Cloud Analytic Services promoted table CARS2 in caslib CASUSER(myUserID) to table CARS2 in caslib 
      CASUSER(myUserID).
NOTE: Cloud Analytic Services promoted table CARS3 in caslib CASUSER(myUserID) to table CARS3 in caslib 
      CASUSER(myUserID).
NOTE: Cloud Analytic Services promoted table CARS4 in caslib CASUSER(myUserID) to table CARS4 in caslib 
      CASUSER(myUserID).
NOTE: Cloud Analytic Services promoted table CARS5 in caslib CASUSER(myUserID) to table CARS5 in caslib 
      CASUSER(myUserID).&lt;/PRE&gt;
&lt;P&gt;No muss, no fuss, no macro required, and no need to count ampersands...&amp;nbsp;&lt;BR /&gt;If you want to hand-type the names of the tables just skip the table.tableInfo step, and modify the tableList assignment statement to something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;tableList={"table1","table2","table3"};&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;May the SAS be with you!&lt;BR /&gt;Mark&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 17:52:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/882981#M348893</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2023-06-29T17:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Promote a session scope table to global scope</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/883405#M349032</link>
      <description>&lt;P&gt;Question: I checked, and all the table involved are not promoted&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="15pg.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/85543iD5E154B222A32811/image-size/large?v=v2&amp;amp;px=999" role="button" title="15pg.png" alt="15pg.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the discussed code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc cas;

tableList={"topic_scoring_v1",
"mkt_topicmodel_svdu",
"mkt_topicmodel_topics",
"mkt_topicmodel_docpro",
"mkt_topicmodel_config",
"mkt_topicmodel_terms"
};

do thisTable over tableList;
	table.promote /
		 caslib="Global Marketing (DNFS)"
		,name=thisTable
/* DROP=TRUE gets rid of the session table creating the globla table */
		,drop=TRUE,
        targetLib="Global Marketing (DNFS)"	;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Should promote the tables and drop the session versions. However, I get the following :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;80   proc cas;
81   
82   tableList={"topic_scoring_v1",
83   "mkt_topicmodel_svdu",
84   "mkt_topicmodel_topics",
85   "mkt_topicmodel_docpro",
86   "mkt_topicmodel_config",
87   "mkt_topicmodel_terms"
88   };
89   
90   do thisTable over tableList;
91   table.promote /
92    caslib="Global Marketing (DNFS)"
93   ,name=thisTable
94   /* DROP=TRUE gets rid of the session table creating the globla table */
95   ,drop=TRUE,
96           targetLib="Global Marketing (DNFS)";
97   end;
98   run;
NOTE: Active Session now CASAUTO.
ERROR: The target table topic_scoring_v1 of the promotion already exists. Please specify a different name.
ERROR: La acción se ha detenido debido a los errores.
ERROR: The target table mkt_topicmodel_svdu of the promotion already exists. Please specify a different name.
ERROR: La acción se ha detenido debido a los errores.
ERROR: The target table mkt_topicmodel_topics of the promotion already exists. Please specify a different name.
ERROR: La acción se ha detenido debido a los errores.
ERROR: The target table mkt_topicmodel_docpro of the promotion already exists. Please specify a different name.
ERROR: La acción se ha detenido debido a los errores.
ERROR: The target table mkt_topicmodel_config of the promotion already exists. Please specify a different name.
ERROR: La acción se ha detenido debido a los errores.
ERROR: The target table mkt_topicmodel_terms of the promotion already exists. Please specify a different name.
ERROR: La acción se ha detenido debido a los errores.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Should have the "Drop" option allowed to promote the tables and at the same time drop the session versions? Why I'm getting the error then?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 10:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/883405#M349032</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2023-07-04T10:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Promote a session scope table to global scope</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/883436#M349050</link>
      <description>&lt;P class=""&gt;I add that to drop the old versions of the promoted tables, before the code before and the action set, I run the following drop codes:&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;proc casutil session=casauto;&lt;/P&gt;&lt;P class=""&gt;dropTable casdata="topic_scoring_v1";&lt;/P&gt;&lt;P class=""&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2023 12:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/883436#M349050</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2023-07-04T12:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: Promote a session scope table to global scope</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/883471#M349069</link>
      <description>&lt;P&gt;Update: I have also tried the following approach to drop table, but same errors when trying promotion with new versions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;proc cas;&lt;BR /&gt;session casauto;&lt;BR /&gt;&lt;BR /&gt;tableList={"topic_scoring_v1",&lt;BR /&gt;"mkt_topicmodel_svdu",&lt;BR /&gt;"mkt_topicmodel_topics",&lt;BR /&gt;"mkt_topicmodel_docpro",&lt;BR /&gt;"mkt_topicmodel_config",&lt;BR /&gt;"mkt_topicmodel_terms"&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/********do loop ***********************************/&lt;BR /&gt;&lt;BR /&gt;do thisTable over tableList;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/**if table exists**/&lt;BR /&gt;&lt;BR /&gt;table.tableExists  result=rc/&lt;BR /&gt;name=thisTable, caslib="Global Marketing (DNFS)";&lt;BR /&gt;print rc;&lt;BR /&gt;&lt;BR /&gt;if rc.exists^=0 then do;&lt;BR /&gt;&lt;BR /&gt;        &lt;BR /&gt;/**drop till removed if exists **/&lt;BR /&gt;&lt;BR /&gt;      &lt;BR /&gt;do until(rc=0);&lt;BR /&gt;                       &lt;BR /&gt;                               &lt;BR /&gt;table.dropTable /&lt;BR /&gt;                                              &lt;BR /&gt;name=thisTable, caslib="Global Marketing (DNFS)"&lt;BR /&gt;                               &lt;BR /&gt;;&lt;BR /&gt;                                     &lt;BR /&gt;table.tableExists  result=rc/&lt;BR /&gt;                                              &lt;BR /&gt;name=thisTable, caslib="Global Marketing (DNFS)";&lt;BR /&gt;                               &lt;BR /&gt;                               &lt;BR /&gt;print rc;&lt;BR /&gt;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;/************************/&lt;BR /&gt;&lt;BR /&gt;end;   &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/***end do loop **************************************/&lt;BR /&gt;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jul 2023 17:12:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/883471#M349069</guid>
      <dc:creator>dcortell</dc:creator>
      <dc:date>2023-07-04T17:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Promote a session scope table to global scope</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/883613#M349109</link>
      <description>&lt;P&gt;I could use some clarification here. What is the goal? Do you want to &lt;EM&gt;drop&lt;/EM&gt; &lt;EM&gt;all copies of the tables listed&lt;/EM&gt; (that is, both session-scoped and global-scoped copies of a table - as seems to be indicated by your most recent entry above) or do you want to &lt;EM&gt;promote all listed tables and ensure only the promoted copy remains (&lt;/EM&gt;as indicated by&amp;nbsp;your original framing of the problem)? If the original interpretation of the problem was correct, what in the provided solution isn't working for you?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jul 2023 17:58:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Promote-a-session-scope-table-to-global-scope/m-p/883613#M349109</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2023-07-05T17:58:07Z</dc:date>
    </item>
  </channel>
</rss>

