Desktop productivity for business analysts and programmers

Problem of developing an Add-In

Accepted Solution Solved
Reply
Contributor
Posts: 47
Accepted Solution

Problem of developing an Add-In

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;

    }

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

}


Accepted Solutions
Solution
‎05-24-2013 08:41 AM
Community Manager
Posts: 2,891

Re: Problem of developing an Add-In

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

View solution in original post


All Replies
Solution
‎05-24-2013 08:41 AM
Community Manager
Posts: 2,891

Re: Problem of developing an Add-In

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

Contributor
Posts: 47

Re: Problem of developing an Add-In

: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!

Community Manager
Posts: 2,891

Re: Problem of developing an Add-In

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


Contributor
Posts: 47

Re: Problem of developing an Add-In

:smileylaugh:

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 269 views
  • 3 likes
  • 2 in conversation