<?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 SAS job to reload Oracle Memory Loaded Tables with Macros in Developers</title>
    <link>https://communities.sas.com/t5/Developers/SAS-job-to-reload-Oracle-Memory-Loaded-Tables-with-Macros/m-p/674828#M890</link>
    <description>&lt;P&gt;hi all,&lt;/P&gt;
&lt;P&gt;I have successfully created an ODBC library that view all oracle datasets then we load the needed tables. However, these tables won't get refreshed in SAS memory unless reloaded again. I am trying to create a job that extracts the loaded data into memory, unload and then reload them again. I am stuck at a point where I can't pass the table name to SAS macro (although it is working in %put statement). forgive me this might be a very easy but tricky part while working with SAS macros. Below are my script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1- listing tables into a dataset (loaded_tables)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods output TableInfo=loaded_tables(where=(Global=1) keep = Name Global);
proc casutil;
list tables incaslib="SAS_CONN_ORA" ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2- inserting these tables into an array so we can loop over them&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
    set loaded_tables nobs = nobs;
    array data Name;
    format t1 $50.;
    retain t1;
    array t[1] $;
    do i = 1 to dim(t);
        if _N_ = 1 then t[i] = put(data[i], 8.);
            else t[i] = compress(t[i] || ',' || put(data[i], 8.));
	*put data[i] ::: this works and prints the tables' names;
    %reload(data[i]); *this is the macro that should drop and reload the table;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;3- Macro to drop and reload the tables (I am stuck at the point of getting the table's names although the previous put data[i] is working:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro reload(table_name);
%put "&amp;amp;table_name"; &lt;FONT color="#FF0000"&gt;*this is not printing the table name;
&lt;/FONT&gt;
/*proc casutil;
    droptable casdata=&amp;amp;table_name incaslib="SAS_CONN_ORA" quiet;
	run;

proc casutil;
	load casdata=&amp;amp;table_name incaslib="SAS_CONN_ORA" 
	outcaslib="SAS_CONN_ORA" casout=&amp;amp;table_name;
run;

*/
%mend reload;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Aug 2020 19:07:00 GMT</pubDate>
    <dc:creator>WaelAburezeq</dc:creator>
    <dc:date>2020-08-05T19:07:00Z</dc:date>
    <item>
      <title>SAS job to reload Oracle Memory Loaded Tables with Macros</title>
      <link>https://communities.sas.com/t5/Developers/SAS-job-to-reload-Oracle-Memory-Loaded-Tables-with-Macros/m-p/674828#M890</link>
      <description>&lt;P&gt;hi all,&lt;/P&gt;
&lt;P&gt;I have successfully created an ODBC library that view all oracle datasets then we load the needed tables. However, these tables won't get refreshed in SAS memory unless reloaded again. I am trying to create a job that extracts the loaded data into memory, unload and then reload them again. I am stuck at a point where I can't pass the table name to SAS macro (although it is working in %put statement). forgive me this might be a very easy but tricky part while working with SAS macros. Below are my script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1- listing tables into a dataset (loaded_tables)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods output TableInfo=loaded_tables(where=(Global=1) keep = Name Global);
proc casutil;
list tables incaslib="SAS_CONN_ORA" ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2- inserting these tables into an array so we can loop over them&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
    set loaded_tables nobs = nobs;
    array data Name;
    format t1 $50.;
    retain t1;
    array t[1] $;
    do i = 1 to dim(t);
        if _N_ = 1 then t[i] = put(data[i], 8.);
            else t[i] = compress(t[i] || ',' || put(data[i], 8.));
	*put data[i] ::: this works and prints the tables' names;
    %reload(data[i]); *this is the macro that should drop and reload the table;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;3- Macro to drop and reload the tables (I am stuck at the point of getting the table's names although the previous put data[i] is working:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro reload(table_name);
%put "&amp;amp;table_name"; &lt;FONT color="#FF0000"&gt;*this is not printing the table name;
&lt;/FONT&gt;
/*proc casutil;
    droptable casdata=&amp;amp;table_name incaslib="SAS_CONN_ORA" quiet;
	run;

proc casutil;
	load casdata=&amp;amp;table_name incaslib="SAS_CONN_ORA" 
	outcaslib="SAS_CONN_ORA" casout=&amp;amp;table_name;
run;

*/
%mend reload;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Aug 2020 19:07:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-job-to-reload-Oracle-Memory-Loaded-Tables-with-Macros/m-p/674828#M890</guid>
      <dc:creator>WaelAburezeq</dc:creator>
      <dc:date>2020-08-05T19:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS job to reload Oracle Memory Loaded Tables with Macros</title>
      <link>https://communities.sas.com/t5/Developers/SAS-job-to-reload-Oracle-Memory-Loaded-Tables-with-Macros/m-p/674852#M891</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
    set loaded_tables nobs = nobs;
    array data Name;
    format t1 $50.;
    retain t1;
    array t[1] $;
    do i = 1 to dim(t);
        if _N_ = 1 then t[i] = put(data[i], 8.);
            else t[i] = compress(t[i] || ',' || put(data[i], 8.));
	*put data[i] ::: this works and prints the tables' names;
    exec_cmd = '%reload(' !! data[i] !! ');';
    call execute('%nrstr(' !! exec_stmt !! ')'); 
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Aug 2020 20:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/SAS-job-to-reload-Oracle-Memory-Loaded-Tables-with-Macros/m-p/674852#M891</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-08-05T20:27:04Z</dc:date>
    </item>
  </channel>
</rss>

