<?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: Loading multiple tables into CAS in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Loading-multiple-tables-into-CAS/m-p/821391#M10480</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/397742"&gt;@Akky1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are 5 tables in the SASHELP library that have '&lt;STRONG&gt;CITI&lt;/STRONG&gt;' as the first 4 characters of the table name.&lt;/P&gt;
&lt;P&gt;(SASHELP is there in every SAS installation by the way)&lt;/P&gt;
&lt;P&gt;Below code loads all of them ( #5 ) in the PUBLIC CASLIB.&lt;/P&gt;
&lt;P&gt;The 2nd data step writes code to drop the tables again from memory. Note the MOD option on the file statement in the 2nd data step. This way (with the MOD option) you add to the code already written to xyz temporary file instead of replacing xyz with new code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cas mySession sessopts=(caslib=casuser timeout=1800 locale="en_US");
caslib _all_ assign;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL noprint;
 create table work.abc as
 select memname 
 from dictionary.tables
 where libname='SASHELP' and substr(memname,1,4)='CITI' and memtype='DATA';
QUIT;

filename xyz temp;

data _NULL_;
 set work.abc end=last;
 file xyz;
 mn=trim(left(memname));
 if _N_=1 then do; PUT 'proc casutil;'; end;
 PUT 'load data=SASHELP.' mn ' outcaslib="PUBLIC" casout="' mn +(-1) '"; run;';
 if last  then do; PUT 'QUIT;'; end;
run;

data _NULL_;
 set work.abc end=last;
 file xyz MOD;
 mn=trim(left(memname));
 if _N_=1 then do; PUT 'proc casutil;'; end;
 PUT ' droptable casdata="' mn +(-1) '" incaslib="PUBLIC" quiet; run;';
 if last  then do; PUT 'QUIT;'; end;
run;

%INCLUDE xyz / source2;
filename xyz clear;

PROC DATASETS library=PUBLIC NoList memtype=DATA;
 delete CITI:; run;
QUIT;

*cas mySession terminate;
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
    <pubDate>Sat, 02 Jul 2022 21:33:23 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2022-07-02T21:33:23Z</dc:date>
    <item>
      <title>Loading multiple tables into CAS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Loading-multiple-tables-into-CAS/m-p/821297#M10478</link>
      <description>&lt;P&gt;Have used below to load a single table into CAS. How can I load all tables into CAS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc casutil;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; load casdata="NATION" casout="NATION" outcaslib="snowLib" incaslib="snowLib";&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 14:41:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Loading-multiple-tables-into-CAS/m-p/821297#M10478</guid>
      <dc:creator>Akky1</dc:creator>
      <dc:date>2022-07-01T14:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Loading multiple tables into CAS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Loading-multiple-tables-into-CAS/m-p/821391#M10480</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/397742"&gt;@Akky1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are 5 tables in the SASHELP library that have '&lt;STRONG&gt;CITI&lt;/STRONG&gt;' as the first 4 characters of the table name.&lt;/P&gt;
&lt;P&gt;(SASHELP is there in every SAS installation by the way)&lt;/P&gt;
&lt;P&gt;Below code loads all of them ( #5 ) in the PUBLIC CASLIB.&lt;/P&gt;
&lt;P&gt;The 2nd data step writes code to drop the tables again from memory. Note the MOD option on the file statement in the 2nd data step. This way (with the MOD option) you add to the code already written to xyz temporary file instead of replacing xyz with new code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cas mySession sessopts=(caslib=casuser timeout=1800 locale="en_US");
caslib _all_ assign;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL noprint;
 create table work.abc as
 select memname 
 from dictionary.tables
 where libname='SASHELP' and substr(memname,1,4)='CITI' and memtype='DATA';
QUIT;

filename xyz temp;

data _NULL_;
 set work.abc end=last;
 file xyz;
 mn=trim(left(memname));
 if _N_=1 then do; PUT 'proc casutil;'; end;
 PUT 'load data=SASHELP.' mn ' outcaslib="PUBLIC" casout="' mn +(-1) '"; run;';
 if last  then do; PUT 'QUIT;'; end;
run;

data _NULL_;
 set work.abc end=last;
 file xyz MOD;
 mn=trim(left(memname));
 if _N_=1 then do; PUT 'proc casutil;'; end;
 PUT ' droptable casdata="' mn +(-1) '" incaslib="PUBLIC" quiet; run;';
 if last  then do; PUT 'QUIT;'; end;
run;

%INCLUDE xyz / source2;
filename xyz clear;

PROC DATASETS library=PUBLIC NoList memtype=DATA;
 delete CITI:; run;
QUIT;

*cas mySession terminate;
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sat, 02 Jul 2022 21:33:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Loading-multiple-tables-into-CAS/m-p/821391#M10480</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2022-07-02T21:33:23Z</dc:date>
    </item>
  </channel>
</rss>

