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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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


It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
qkaiwei
Calcite | Level 5

:smileylaugh:

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1083 views
  • 3 likes
  • 2 in conversation