BookmarkSubscribeRSS Feed
SAS-Fan
Calcite | Level 5

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:

 

Programming with Visual Basic 

 

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?

 

2 REPLIES 2
JOL
SAS Employee JOL
SAS Employee
Try reposting under Programming -> Developers
SASKiwi
PROC Star

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. 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 486 views
  • 0 likes
  • 3 in conversation