I did not find an effective solution to append tables directly in CAS. I create a table in SPRE, drop the table in CAS (if it exists), and then promote it back. we do this A LOT every hour. so I have a nice auto call macro that handles a wide range of activities around updating data in CAS, but i plucked out a few macros that
might help you out. i find them very useful.
you end up invoking the %checkcasresult() macro by providing source table and target table information.
good luck,
%MACRO UniformDelay();
%PUT Insert Random Delay, Between 0 and 1 Second;
DATA _null_;
UniformDelay = rand('Uniform');
rc=SLEEP(UniformDelay,1);
RUN;
%MEND;
/* Macro for Dropping a Table from CAS */
%macro DropIt(name=);
proc casutil incaslib="public";
droptable casdata="&name";
/* list files; */
run; quit;
%mend;
/* Load table to CAS and Promt */
%macro LoadPromoteIt(name=);
proc casutil;
load data=work.&name outcaslib='public' promote ;
save casdata="&name" replace;
run; quit;
%mend;
/* Remove existing table from CAS if loaded already */
%macro deleteCASdsifexists(lib,name);
%if %sysfunc(exist(&lib..&name.)) %then %do;
%put DeleteCASDSifExistsMacro;
%DropIt(name=&name);
%end;
%if %sysfunc(exist(&lib..&name.)) %then %do;
%put First Attempt Failed; Trying one more time;
%UniformDelay();
%DropIt(name=&name);
%end;
%mend ;
%macro checkCASresult(Slib,Sname,Tlib,Tname,email);
%PUT Source Data &Slib..&Sname.;
%PUT Target Data &Tlib..&Tname ;
%if %sysfunc(exist(&Slib..&Sname.)) %then %do;
%put CheckResultMacro;
%UniformDelay();
%deleteCASdsifexists(&Tlib, &Tname);
%UniformDelay();
%put loadTable;
%LoadPromoteIt(name=&Sname);
%end;
%else %do;
%put table not there;
%end;
%mend;