I have SAS legacy code which is migrated to SAS Viya. In the code ,there are some X-commands which does not execute in SAS Viya. How do I run my x-commands in Viya Studio.
Example -
x "rm /data/sas/xplo/abc2405kjh.csv";
Hello,
You probably have NOXCMD as an option.
Check the log after submitting this:
proc options option=xcmd; run;
But for the operating system command 'rm', you can use the SAS FDELETE function instead!
The FDELETE function allows us to delete directories or files directly controlled by SAS.
Koen
Hello,
SAS has many of these functions prefixed with 'f' for dealing with external files.
BR, Koen
data _null_;
rc = filename(fref,"/data/sas/xplo/abc2405kjh.csv");
rc = fdelete(fref);
rc = filename(fref);
run;
Also see the documentation of the FDELETE Function. The other file handling functions are found right next to it.
My understanding is that if you have non-CAS eligible statements/functions, the data step will execute in SPRE (SAS Compute), which is also part of Viya.
Just as with SAS 9.4, XCMD must be enabled.
Have you seen this page in the official documentation?
That's something that a SAS Admin has to do, not an individual user.
Hello @USP2405
The SAS Viya Administrator can enable XCMD in the SAS Environment manager for SAS Studio V.
This link shows step by step how to enable XCMD in environment Manager. The method works.
https://communities.sas.com/t5/SAS-Communities-Library/SAS-Viya-3-5-SAS-Studio-and-SAS-Compute-Serve...
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!