BookmarkSubscribeRSS Feed
Calcite | Level 5

Dear community,


We recently upgrade our SAS environment from PC SAS to SAS Studio. After some research, we decided to use SAS Integration Technologies to build our batch submit tool (remote submit programs from client machines/VMs to SAS server). The prototype works on our currently VMs (which has PC SAS installation). We need to test the tool on the environment that has no BASE SAS installation. Based on the documentation, I was under the impression that it should work as long as SAS Integration Technologies client for windows is installed. However, after testing I couldn't get the tool running on the test machine. To be accurate, with SAS Integration Technologies installed, the tool can run but failed in creating workspace server. Below is the (PowerShell) code that fails:


$objFactory = New-Object -ComObject SASObjectManager.ObjectFactoryMulti2
$objServerDef = New-Object -ComObject SASObjectManager.ServerDef
$objServerDef.MachineDNSName = "<SAS-Workspace-Server-Address>"
$objServerDef.Port = 8591 
$objServerDef.Protocol = 2
$objServerDef.ClassIdentifier = "440196d4-90f0-11d0-9f41-00a024bb830c"

try {
    # create and connect to the SAS session 
    $workspaceserver = $objFactory.CreateObjectByServer(
        "SASApp", # server name
        $objServerDef, # built server definition
        "<User-Name>", # user ID
        "<Password>"    # password
    $workspaceserver.LanguageService.Submit("option set=a=""Hello World"";") 
    $sasrtn = "" 
    $rc = $WorkspaceServer.Utilities.HostSystem.GetEnv("a", [ref] $sasrtn) 
    Write-Host $sasrtn
catch [system.exception] {
    Write-Host "Could not connect to SAS session: " $_.Exception.Message


The error I got is 

Could not connect to SAS session:  <connectionAttempts>
                <description>Unspecified error</description>

The same code can run sucessfully on our current VM where BASE SAS is installed. I can't tell if this is due to some settings on the test machine that is irrelevant to SAS, or is it due to the fact that SAS Integration Technologies alone cannot support the funtion of this code.


Does anyone have any experience on this topic? Thanks in advance!


Barite | Level 11

This doesn't answer your question but it could be something to consider given your use case (migration of PC SAS to work on a remote machine)

My team have built an open source REST API for Base SAS, the source is here:

Using this you can batch submit SAS programs from any client on any network connected (non-SAS) machine, including the SASjs CLI (, and fetch both the log and print output.

Docs are here:

If you were to use the SASjs CLI to set up your batch process, the benefit would be a very smooth migration to Viya at a later date (the functionalities work the same regardless of server type)

SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
Barite | Level 11

Apologies, I don't have SAS so working from memory.


I thought that when you installed SAS IT, it would install a small client program for testing. It is in your Windows Menu under SAS Integration Technologies. Use that to get your client working before putting it into PowerShell. 


Here is some C# code I have used with references to InterOp.ADODB, SAS, SASObjectManager, SASWorkspaceManager). I have lots of code around this area so ping if needed and I will drop on github. When given a choice, I prefer C# to PowerShell. Both are good but C# is easier to read and maintain, IMO:


        private Workspace CreateWorkspace()
            Workspace sasWorkspace;
                var objFactory = new ObjectFactoryClass();
                var serverDef = new ServerDefClass();

                // ************************************************
                // Configure the SAS server information.
                // ************************************************

                serverDef.BridgeEncryptionAlgorithm = "SASProprietary";
                serverDef.BridgeEncryptionLevel = EncryptionLevels.EncryptUserAndPassword;
                serverDef.MachineDNSName = DnsName;
                serverDef.Port = Port;
                serverDef.Protocol = Protocols.ProtocolBridge;

                // ************************************************
                // Create the connection.
                // ************************************************

                sasWorkspace =
                    (Workspace) objFactory.CreateObjectByServer("BridgeConnection", true, serverDef, UserId, Password);
            catch (Exception ex)
                util.HandleError(MethodBase.GetCurrentMethod().Name, ex);
                return null;
            return sasWorkspace;



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 3 in conversation