SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 15179: Executing the SYSTEM function and X Command via the SAS® Stored Process Server

DetailsAboutRate It

When running the SAS® Stored Process Server, the XCMD option is turned off by default. So, by default, you will not be able to use the SYSTEM function, the X command, or the PIPE option in a FILENAME statement.

If you attempt to use the X command or SYSTEM function, you will receive the following warning message:

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

If you attempt to use the PIPE option in a FILENAME statement, you will receive the following error message:

ERROR: Insufficient authorization to access PIPE.

In SAS® 9.2 and later for the SAS Stored Process Server on either Windows or UNIX, you can enable the XCMD option by doing the following:

  1. Using SAS® Management Console, under Server Manager, select:
    SASApp – Logical Stored Process Server ► SASApp – Stored Process Server
  2. Then select Properties.
  3. In the SASApp – Stored Process Server Properties window select:
    OptionsAdvanced OptionsLaunch Properties (tab)
  4. On the Launch Properties tab select:
    Allow XCMD
  5. Click OK to save the setting.
  6. Stop and Restart your SAS Object Spawner

 

In SAS 9.1.3, you can permit the use of the above commands by doing the following:

  1. Specify the ALLOWXCMD option when starting the SAS 9.1.3 Object Spawner.
  2. Specify the XCMD option when starting the SAS Stored Process Server.

The steps to enable the XCMD and NOXWAIT options will be different in the Windows and UNIX environments. The steps for each environment are described below.

The following steps describe the approach to set these options for SAS 9.1.3 on a Windows platform.

  1. Stop your SAS Object Spawner.
  2. Go to the SAS Object Spawner directory. For example:

    <SAS-configuration-directory>\Lev1\SASMain\Objectspawner
  3. Make a backup copy of your ObjectSpawner.bat file.

  4. Edit the ObjectSpawner.bat file as follows:

    1. In the ObjectSpawner.bat file, find the line that begins with

      start /b "Object Spawner"

      and contains the -install option.

    2. Change:

      -install

      to

      -install -allowxcmd

    3. This effectively adds the -allowxcmd option on the command line.

  5. If installed as a Windows Service, perform Steps 5, 6 and 7. Otherwise, continue to Step 8.
  6. In a DOS window, go to the Object Spawner directory. For example:

    <SAS-configuration-directory>\Lev1\SASMain\Objectspawner
  7. Enter the following command (to remove the existing Windows Service for the Object Spawner):

    > objectspawner remove
  8. Enter the following command (to create a Windows service for the Object Spawner, which uses the newly ObjectSpawner.bat file):

    > objectspawner install
  9. Start the Object Spawner as a Windows service. Or start it using the ObjectSpawner.bat file (if you are not using a Windows Service).

  10. Edit the SAS configuration file that is used by the SAS Stored Process Server. For example:

    <SAS-configuration-directory>\Lev1\SASMain\StoredProcessServer \sasv9_StorProcSrv.cfg
  11. Add the following two lines (near the bottom) in the SAS configuration file:

    -xcmd
    -noxwait
    

The following steps describe the approach to set these options for SAS 9.1.3 on a UNIX platform.

  1. Stop your Object Spawner.
  2. Go to the Object Spawner directory. For example:

    <SAS-configuration-directory>/Lev1/SASMain/Objectspawner
  3. Make a backup copy of your ObjectSpawner.sh file.

  4. Edit the ObjectSpawner.sh file as follows:

    1. Change (on two lines where the option occurs):

      -saslogfile

      to

      -allowxcmd -saslogfile

    2. This effectively adds the -allowxcmd option to the command that starts your Object Spawner.
  5. Edit the SAS configuration file that is used when starting the SAS Stored Process Server. Add the following line (near the bottom) in the SAS configuration file:

    -xcmd
  6. Start your Object Spawner.


Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemSAS Integration TechnologiesMicrosoft Windows XP Professional9.1 TS1M3 SP1
Microsoft Windows Server 2003 Standard Edition9.1 TS1M3 SP1
Microsoft Windows NT Workstation9.1 TS1M3 SP1
Microsoft® Windows® for 64-Bit Itanium-based Systems9.1 TS1M3 SP1
Microsoft Windows 2000 Server9.1 TS1M3 SP1
Microsoft Windows Server 2003 Datacenter Edition9.1 TS1M3 SP1
Microsoft Windows Server 2003 Enterprise Edition9.1 TS1M3 SP1
Microsoft Windows 2000 Professional9.1 TS1M3 SP1
Microsoft Windows 2000 Datacenter Server9.1 TS1M3 SP1
Linux9.1 TS1M3 SP1
Microsoft Windows 2000 Advanced Server9.1 TS1M3 SP1
64-bit Enabled HP-UX9.1 TS1M3 SP1
64-bit Enabled Solaris9.1 TS1M3 SP1
HP-UX IPF9.1 TS1M3 SP1
64-bit Enabled AIX9.1 TS1M3 SP1
Tru64 UNIX9.1 TS1M3 SP1
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.