BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
qkaiwei
Calcite | Level 5

When developing an Add-in for enterprise guide, and executing a stored process using

obWs.LanguageService.StoredProcessService.Execute("abc.sas","")

I find that, if the work library path of obWs is /sas/temp/abcde, then all datasets created by the stored process are stored in a sub-directory under the work path, such as /sas/temp/abcde/a12345/.

So I can't visit them using OleDbConnection got from obWs because the work library paths of obWs and StoredProcessService are different.

Any ideas? Thanks!

public SAS.Shared.AddIns.ShowResult Show(System.Windows.Forms.IWin32Window Owner) {

    SAS.Tasks.Toolkit.SasServer obServer;

    SAS.IWorkspace obWs = null;

    string strServer = consumer.AssignedServer;

    consumer.Workspace(strServer);

    try {

        obWs = consumer.Workspace(strServer) as SAS.Workspace;

        obServer = new SAS.Tasks.Toolkit.SasServer(strServer);

    } catch {

        return SAS.Shared.AddIns.ShowResult.Canceled;

    }

.....................

}

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

Hello,

Is there a reason that you want to execute the program as a Stored Process instead of simply running the program "as is" in your SAS Workspace?  You can effectively run the program by using:

SAS.Tasks.Toolkit.SasSubmitter submitter = new SasSubmitter(sasServer);

string outLog;

bool success = submitter.SubmitSasProgramAndWait("%include '/sas/myprogram/abc.sas';", out outLog);


When you run a stored process, the SAS session that executes the program is different than the SAS Workspace that SAS Enterprise Guide is connected to.  You cannot easily share the content of the WORK library, since it's actually a different SAS executive that's running.


The SAS Macro Variable Viewer task (GitHub link) shows an example of how to run a program interactively.


And LanguageService.StoredProcessService is an older, legacy method for stored processes.  When we talk about SAS Stored Processes in the SAS 9.x (9.1 and later) environment, there is another API dedicated to managing/running stored processes -- all tied to SAS Metadata.  You can find the documentation and examples for that API within StoredProcessService.chm, found in your local Integration Technologies installation folder (ex: C:\Program Files\SAS\SharedFiles(32)\Integration Technologies).


Chris

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

View solution in original post

4 REPLIES 4
ChrisHemedinger
Community Manager

Hello,

Is there a reason that you want to execute the program as a Stored Process instead of simply running the program "as is" in your SAS Workspace?  You can effectively run the program by using:

SAS.Tasks.Toolkit.SasSubmitter submitter = new SasSubmitter(sasServer);

string outLog;

bool success = submitter.SubmitSasProgramAndWait("%include '/sas/myprogram/abc.sas';", out outLog);


When you run a stored process, the SAS session that executes the program is different than the SAS Workspace that SAS Enterprise Guide is connected to.  You cannot easily share the content of the WORK library, since it's actually a different SAS executive that's running.


The SAS Macro Variable Viewer task (GitHub link) shows an example of how to run a program interactively.


And LanguageService.StoredProcessService is an older, legacy method for stored processes.  When we talk about SAS Stored Processes in the SAS 9.x (9.1 and later) environment, there is another API dedicated to managing/running stored processes -- all tied to SAS Metadata.  You can find the documentation and examples for that API within StoredProcessService.chm, found in your local Integration Technologies installation folder (ex: C:\Program Files\SAS\SharedFiles(32)\Integration Technologies).


Chris

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
qkaiwei
Calcite | Level 5

:smileyblush:

You know, as a programmer outside SAS, the possible way of developping EG Add-In is to guess and try, more examples and papers need to be brought into the public.

Anyway, thank you!

ChrisHemedinger
Community Manager

No need to guess and try!  There is a comprehensive book available on this topic:

Custom Tasks for SAS Enterprise Guide using Microsoft .NET

by Chris Hemedinger


Visit http://go.sas.com/customtasksapi to learn more and see lots of examples.


And SubmitSASProgramComplete is the event that is raised for asynchronous processing.  The book describes this class and provides examples.


Chris


Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
qkaiwei
Calcite | Level 5

:smileylaugh:

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 4 replies
  • 1125 views
  • 3 likes
  • 2 in conversation