I tried to using powershell to call SAS via COM. However it doesn't work in some situation. I have a SAS installed on a remote windows machine with no SAS Integration Technologies (e.g. no IOM access or sas EG access or metadata server or no workspace server). When I login in via windows remote desktop, I can run sas code via COM in vscode. But if I sign in by SSH, I have the same error report as you reported. Below I tried step by step powershell script in the ssh terminal, an error throwed in `$objSAS.LanguageService.Submit` $objFactory = New-Object -ComObject SASObjectManager.ObjectFactoryMulti2
$objServerDef = New-Object -ComObject SASObjectManager.ServerDef
$objServerDef
$objServerDef.MachineDNSName = "xxx.xx.x.x" # SAS Workspace node
$objServerDef.Port = 0 # workspace server port
$objServerDef.Protocol = 0 # 0 = COM protocol
$objServerDef
# Class Identifier for SAS Workspace
$objServerDef.ClassIdentifier = "440196d4-90f0-11d0-9f41-00a024bb830c"
# create and connect to the SAS session
$objSAS = $objFactory.CreateObjectByServer(
"Local", # server name
$true,
$objServerDef, # built server definition
"", # user ID
"" # password
)
$program = "proc sql; create table work.test as select* from perm.data; proc print data=work.test;run;"
$objSAS.LanguageService.Submit($program);
$objSAS.Close() An error raised after `$objSAS.LanguageService.Submit($program)` You cannot call a method on a null-valued expression.
+ $objSAS.LanguageService.Submit($program);
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [],RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull **Environment:** Client OS: Windows 2019 SAS version: SAS 9.4 with ITC only, but not IT (e.g. IOM not enabled)
... View more