Hello,
SAS VIYA: 3.5
SAS Studio: 5.2
Has anyone managed to write to a non standard caslib in a data step?
I have tried the following but it returns error.
data "My CAS".table;
set casuser.table1;
run;
I am aware that it is possible to do it in a proc fedsql.
proc fedsql sessref=test;
create table "My CAS".table as
select * from
casuser.table1;
quit;
Thank you,
smm662002
How did the "My CAS" caslib get defined? Does it show up if you list all caslibs by using
caslib _all_ list; /* display all caslibs to log */
I have never done it, but the SAS documentation states: "You can use name literals (n-literals) in caslib names. However, the CAS LIBNAME engine statement does not support caslib names with name literals in them."
To me, this suggests that you might try
data "My CAS"n.table;
...
run;
because "My CAS"n is the standard way to specify an n-literal. Let us know if that works or not.
1. How did the "My CAS" caslib get defined?
2. If you run the following code, does the log verify that the value of the VALIDVARNAME option is 'ANY'?
proc options option=validvarname value;
run;
For example, the output might look like this:
Option Value Information For SAS Option VALIDVARNAME
Value: ANY
Scope: Compute Server
> but this is on the Compute Server while the code would run on CAS server.
Not quite true. All PROCs and DATA steps are parsed on the compute server, and so the librefs and caslibs have to be defined there. Your code executes on the client, but if all data are in CAS tables, then it results in a call to the dataStep.runCode action, which will actually perform the data processing.
I don't know how to resolve your problem by using the DATA step. However, if your goal is to create a new table, you could use the LOAD statement in PROC CASUTIL or directly call the table.loadtable action by using PROC CAS.
I can't test this code since I don't know how to define a "My CAS" caslib, but does the following code show your data table?
/* UNTESTED code */
proc casutil;
list tables incaslib="My CAS"; /* does this work? */
quit;
If so, try
/* if so, try to transfer it to caseuser.table1 */
proc casutil;
load casdata='table' incaslib="My CAS"
casout='table1' outcaslib='casuser';
list tables incaslib='casuser';
run;
I am out of ideas. Perhaps @alexal or someone else can assist.
Please show the library definition and exact error you are receiving when using data step.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.