tags:

views:

27

answers:

1

I have written some SAS code that calls R via the x command (I am using SAS 9.1.3 so there is no native SAS interface to R).

OPTIONS XWAIT XSYNC;
 X """&r_path."" --no-save --quiet < ""&out_code_folder.\code.r"" > ""&out_code_folder.\abba.log""";

This code works correctly when I run it in the SAS IDE but when I try to run the same code in VBA using (here strSAScode contains the above mentioned SAS code).

   Dim obWM As SASWorkspaceManager.WorkspaceManager
    Dim temp_dispaly_alert As Boolean
    Dim sm As SAS_Management    
    Debug.Print strSASCode    
    Set sm = New SAS_Management

    'Set obServerDef = New SASWorkspaceManagerServerDef
    Set obWM = New SASWorkspaceManager.WorkspaceManager
    Set obSAS = obWM.Workspaces.CreateWorkspaceByServer("MyServerName", VisibilityProcess, Nothing, "", "", "")
    Set sm.obLS = obSAS.LanguageService
    temp_dispaly_alert = Application.DisplayAlerts
    Application.DisplayAlerts = False
    sm.obLS.Submit strSASCode

Now every other code works, except the x command. Please Help.

+3  A: 

Hi

By default, use of SYSTEM and X commands is disabled when accessed via techniques that use integration technologies due to potential security risks.

Have you followed the steps for 9.1.3 on Windows described in this usage note? It describes how to enable this functionality on your SAS server; you may need to adapt what's described for the workspace, instead of the stored process, server.

sasfrog