When I use the query builder in SAS EG to write a file to CAS, the table becomes a session-scope in-memory table. When I want to promote this table to a global-scope table and save this table to disk aswell, I run the following code. data _null_;
call symputx('libref',scan("&syslast",1,'.'));
call symputx('tablename',scan("&syslast",2,'.'));
run;
%let caslibname = %sysfunc( libref_to_caslibname(&libref) ); /* libref_to_caslibname is a function I wrote to retrieve the caslibname from the libref */
proc casutil incaslib="&caslibname" outcaslib="&caslibname";
promote casdata="&tablename";
quit;
proc casutil incaslib="&caslibname" outcaslib="&caslibname";
save casdata="&tablename";
quit; This works great, but I want other users to easily acces this code snippet aswell. I tried making a stored procedure for this code, but the problem is that the stored procedure executes in a new workspace session. This means that My &syslast doesn't contain the table I want to promote and save. I tried using a prompt and use &syslast as an input for the promt but this doesn't work (just the string '&syslast' is passed, instead of the value of &syslast). With a new workspace session come a new cas session, so I couldn't even promote and save the tables if I solve problem 1. Is it possible to run a stored procedure in the current workspace session? Or is there an alternative way to share this code snippet/program with end users?
... View more