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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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