- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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";
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
But there are few more commands like rm, rm -f , cp (copying file from one path to another path).
I will try this option. Hope it will work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
SAS has many of these functions prefixed with 'f' for dealing with external files.
- fdelete
- fexist
- fileexist
- fopen
- fclose
- fcopy
- fappend
- ...
BR, Koen
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Our files are on unix and we have x commands for that.
Could you please tell me how these SAS function will work for this x command example.
x "rm /data/sas/xplo/abc2405kjh.csv";
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Just as with SAS 9.4, XCMD must be enabled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Have you seen this page in the official documentation?
That's something that a SAS Admin has to do, not an individual user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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...