Learning SAS? Welcome to the exclusive online community for all SAS learners.

Enable X command in SAS Studio

Reply
New Contributor
Posts: 4

Enable X command in SAS Studio

 I like to run few commands like deleting large number of files via SAS code. However, the system replies

 

ERROR: Shell escape is not valid in this SAS session.

 

Now the solution to rectify this (enable x command) is provided in the manual but too cryptic.

 

  1. In the Windows service, stop the SASStudioSpawner.
  2. As an administrator, open a command window and enter this command: sc delete “SASStudioSpawner”.
  3. Next, enter this command: “C:\Program Files\SASHome\SASFoundation\9.4\objspawn.exe” —configFile “C:\sas\studioconfig\spawner\spawner.cfg” —install —name SASStudioSpawner —servicedescription “SAS Studio Object Spawner” —logconfigloc “C:\sas\studio\config\spawner\logconfig.xml” —allowxcmd
     
    I am unable to use this due to many reasons. For example, I am unable to find SASStudioSpawner to stop it. Secondly, there is no SASFoundation inside SASHome. Finally there is no SAS directory in inside C: drive.
     
    I wonder if you can help me how to enable x command through more easy to follow steps.
     
    thanks, Regi

 

 

 

Super User
Posts: 7,854

Re: Enable X command in SAS Studio

Since you posted this in the Analytics U community, I suspect you are using SAS University Edition. if this is the case, you cannot do this. SAS UE is a closed environment for learning purposes, and cannot be reconfigured.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 7,988

Re: Enable X command in SAS Studio

SAS UE version comes as a Virtual Image, it does not have a c: nor is it related to c: on your local machine, it is all encapsulated within the VI.  So you would need to perform those steps within the virtual image. 

 

However, that being said, X commands are turned off for a reason.  Doing file manipulation via OS can be extremely risky - which you will find out one day when you wipe a drive.  I would highly recommend not doing things this way at all.  If you really have to do this (and again, I strongly advise against it - but noboddy listens until Windows stops working as half its files have been removed accidentally) then use the SAS functions (assuming they are in UE edition):

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245893.htm

 

Do note, that the UE is a learning edition, it is not meant to be used for any serious purpose.

Valued Guide
Posts: 505

Re: Enable X command in SAS Studio

SOAPBOX ON

 

 Good point 'esteemed afvisor'. NOXCMD is often the default for EG and SAS Studio because those products are directed to non programmers. Programmers need an operating system to leverage SAS with  popular analytic packages like R, Perl and Python. 

 

SOAPBOX OFF

 

Super User
Super User
Posts: 7,988

Re: Enable X command in SAS Studio

Posted in reply to rogerjdeangelis

X option is turned off in almost all instances I have come across.  The reason is that it is very dangerous.  Access to the OS can allow any number of: removals of data, either accidentally or maliciously.  It can also allow backdooring - i.e. system security avoidance.  Generally speaking there is rarely any need to goto the system level, sure occasionally there maybe a call for directory commands or simliar and SAS provides functions for that, so again, no need to drop to OS level for that.

 

As for running third party software such as R, Python, well not everyone is using those, and if you are (or considering it), then there should be a process in place to govern the use of said items which you and your IT group would work towards, perhaps as an integrated development area with cut down access, so the unvalidated %delete_some_files() macro doesn't go and wipe out your OS files or that connect_to_dodgy_site python script doesn't retrieve a gb of copyrighted material.

 

So yes, to quantify, there are very few reasons why a SAS user would need to go to OS level commands, and the risk therefore cannot be understated.

Super User
Posts: 7,854

Re: Enable X command in SAS Studio

Now here I beg to differ. If J. Random User is able to do more than kill his own files (which can be restored from backup anyway), the system administrator has f***ed up. Big time.

I'd rather be concerned with the intricacies of SAS metadata, where the fine granularization of permissons is much more inviting to oversight.

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 4

Re: Enable X command in SAS Studio

Thanks very much for all the suggestions. Looks like I can't use SAS Studio for this. I switched to Licensed SAS and it was a quite simple.

 

thanks again,

Regi Mathew

Ask a Question
Discussion stats
  • 6 replies
  • 3075 views
  • 1 like
  • 4 in conversation