Hi,
I have code that is sometimes executed normally (windows sas 9.2, EG 4.3) and sometimes executed via a stored process
(the two are linked together in Eguide)
I would like to execute code only if It's running from a stored process.
%If (this is running in a stored process)
%then %do;
%stpbegin;
%end;
I thought to do it with a system variable but I couldn't find any that gives such information.
thanks,
I do not have access to run stored process, but when I played with EG a few years ago I found that I could tell if I was running code from EG because it created macro variable _CLIENTAPP. It also created macros (not variables) name ENTERPRISEGUIDE and _EG_CONDITIONAL_DROPDS. I am not sure if that is still true or if it would distinguish between code submitted via EG vs stored process execution.
Hi,
I don't understand what you mean by executed normally vs executed via a stored process. Can you explain a bit more?
Is the code executed by Enterprise Guide in each scenario?
Are you saying you have a stored procedure, and the source code of the stored procedure %includes some other code? And you want to tell if that second bit of code has been %included by a stored process or not?
Thanks,
--Q.
Hi,
A: Executed normally = a program executed by Eguide
B: executed as Stored Process = Stored Process executed by EGuide OR executed by web (Stored Process Web Application)
Lets say I have this little bit of code:
%If &MyCondition
%then %do;
%stpbegin;
%end;
I need to find the right condition to make this code do nothing when A and do "%stpbegin" when B.
Let me know if I'm not yet clear enough,
Thanks,
I do not have access to run stored process, but when I played with EG a few years ago I found that I could tell if I was running code from EG because it created macro variable _CLIENTAPP. It also created macros (not variables) name ENTERPRISEGUIDE and _EG_CONDITIONAL_DROPDS. I am not sure if that is still true or if it would distinguish between code submitted via EG vs stored process execution.
That's exactly what I was looking for
%put &_CLIENTAPP;
A:
'SAS Enterprise Guide'
B:
SAS Enterprise Guide; CLR 2.0.50727.3620; Microsoft Windows NT 5.1.2600 Service Pack 3
OR
StoredProcessService 9.2; JVM 1.6.0_16; Windows Server 2008 (amd64) 6.1
Thanks !
Final thing :
%macro conditionalstpbegin() / store
DES='Conditionally executes %stpbegin';
%put &_CLIENTAPP;
%if &_CLIENTAPP = 'SAS Enterprise Guide' %then %do;
%put Not Stored Process °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°;
%end;
%else %do;
/* SAS Enterprise Guide; CLR 2.0.50727.3620; Microsoft Windows NT 5.1.2600 Service Pack 3
OR
StoredProcessService 9.2; JVM 1.6.0_16; Windows Server 2008 (amd64) 6.1 */
%put Stored Process °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°;
%STPBEGIN
%end;
%mend conditionalstpbegin;
%conditionalstpbegin;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.