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;
}
.....................
}
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
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
: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!
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
:smileylaugh:
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.
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.