I am asynchronously submitting SAS code via the COM interface. Since it seems to be documented best, let's use Visual Basic to achieve this:
This documentation is somewhat rudimentary. So if you know a more detailed resource, I'd appreciate it very much to be told about it.
Anyway, here is my attempt to asynchronously submit SAS code from Visual Basic:
Option Explicit On Imports SAS Imports SASObjectManager Module Program
Private WithEvents ls As LanguageService Private Sub ls_SubmitComplete(ByVal Sasrc As Long) System.Console.WriteLine("Completed." + Sasrc) End Sub Sub Main(args As String()) Dim factory As New ObjectFactory() Dim server As New ServerDef() server.Protocol = 2 server.MachineDNSName = "*** HOSTNAME ***" server.Port = 8591 Dim workspace As Workspace = factory.CreateObjectByServer("Workspace", True, server, "** USER ***", "*** PASSWORD ***") ls = workspace.LanguageService ls.Async = True ls.Submit("%put Test;") System.Threading.Thread.Sleep(10000) End Sub
End Module
Here, I tried to adapt the approach described in Receiving events and the more detailed but outdated LanguageService Object.
The problem is that, even though the submit completes successfully, ls_SubmitComplete is never called, i.e. the message "Completed." won't appear.
Could anyone help me how to properly receive and handle such events?
I think it would be safe to assume that you are using a little-used way to interface with SAS given the lack of response on the Community. You could try a Tech Support track or if you explained your business need in more detail perhaps there is a better-supported approach.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.