I think it's because you are not specifying the caslib in the dataDiscovery.profile action.
In CAS, you have what's called an active caslib. The active caslib is like your current working directory. If you do not specify a caslib, CAS will use the active caslib. By default, the Casuser caslib is typically the active caslib. You can check with this code:
proc cas;
sessionProp.getSessOpt / name = 'caslib';
quit;
/* results */
{caslib=CASUSER(user-name)}
In your working code you changed the active caslib in the CAS statement to the AAAA caslib. Now if you specify a CAS table without specifying where the CAS table is, it'll use AAAA by default.
cas mysess sessopts=(caslib=&caslib.);
Then you load the sashelp.cars SAS data set into memory in the AAAA caslib. Now this data set was loaded to the AAAA caslib (whatever data source that connects to. Could be a database, path, cloud, etc.). In the CASUTIL code you specified the outcaslib parameter, indicating which caslib you want to load this table to. If you didn't specify the outcaslib parameter, it would use the active caslib.
proc casutil;
load data=&libname..&table.
outcaslib="&caslib." casout="&table." REPLACE;
run;
In your dataDiscover.profile action you don't specify where the CAS table you want is. So SAS will use the active caslib by default. In your working code the active caslib is AAAA since you set it in your CAS statement. In the code that's erroring out my guess is the active caslib is Casuser, and the CARS table doesn't exist in Casuser.
dataDiscovery.profile result=r / table={name="&table."}, /* <--where should I look for this table??? SAS will look in the active caslib */
casOut={name="Profilazione", replace=true}; /* <--where should I create this table??? SAS will use the active caslib */
run;
I recommend always specifying the caslib and not relying on the active caslib, even though it's not always required. It's very easy to change the active caslib accidently, and this could cause issues like this. Being explicit avoids these issues and honestly makes your code easier to read.
Here is how I would type out the action.
proc cas;
loadactionset / actionSet="dataDiscovery";
run;
dataDiscovery.profile result=r /
table={
name="&table.",
caslib="&caslib" /*Specify input caslib. If this is omitted, the active caslib is used */
},
casOut={
name="Profilazione",
caslib="&caslib", /*Specify output caslib. If this is omitted, the active caslib is used */
replace=true
};
quit;
I also have a series of blogs on CAS actions. Feel free to check out them out: https://blogs.sas.com/content/sgf/2021/08/06/cas-action-a-series-on-fundamentals/
... View more