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

Seems a benefit of stored processes is that a single stored process could be invoked by lots of different applications (web report studio, stored process web app, EG, office-add on, information delivery portal, blah blah).

Sometimes the code executed should vary, depending on which application invoked the process.  For example, a stored process might give user option of using a prompt to set _odsdest= html | rtf | pdf.  If that stored process is invoked from SPWA, all should be fine.  But if it is invoked from office-add on and user selects PDF, the stored process should force the destination to be rtf or html, because Excel knows not of pdf.  Or maybe I am coding a javascript alert, which I guess would only work when the process is called from SPWA or IDP.

Is there a macro variable (or other environment variable) that can reliably indicate what sort of app invoked the stored process?  So I would use it the same way as in vanilla SAS, I use &SYSENV to determine if code is being run in interactive mode or batch?

Thanks,

--Q.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  One thing that I do is test the value or existence of the automatic variable &_URL -- if it has a value, then the stored process was requested by either the IDP or the SPWA. If &_URL is not in the global symbol table, then the stored process was requested by a different client app. If you are allowing the users to select a value for destination, then of course, you can test the value of &_ODSDEST -- if they were using RTF or PDF, for example, you might not use your code that inserts JavaScript.. but for JavaScript, testing &_URL is probably more reliable than &_ODSDEST.

  In some instances, &_CLIENT might give you something usable. But, if the CLIENT cannot be determined, then you get just server info. New with 9.3 is &_MSOFFICECLIENT, whose value will tell you the name of the Office client (Excel, Word, PowerPoint, or Outlook) that made a request for a stored process.

  The bottom line is that you'd have to code some tests, probably in a macro program inside your stored process. The full list of reserved macro variables differed in earlier versions of SAS. This is the list for 9.3 in the doc:

http://support.sas.com/documentation/cdl/en/stpug/62758/HTML/default/viewer.htm#p184mqqbi9w6qjn1q061...

cynthia

View solution in original post

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:

  One thing that I do is test the value or existence of the automatic variable &_URL -- if it has a value, then the stored process was requested by either the IDP or the SPWA. If &_URL is not in the global symbol table, then the stored process was requested by a different client app. If you are allowing the users to select a value for destination, then of course, you can test the value of &_ODSDEST -- if they were using RTF or PDF, for example, you might not use your code that inserts JavaScript.. but for JavaScript, testing &_URL is probably more reliable than &_ODSDEST.

  In some instances, &_CLIENT might give you something usable. But, if the CLIENT cannot be determined, then you get just server info. New with 9.3 is &_MSOFFICECLIENT, whose value will tell you the name of the Office client (Excel, Word, PowerPoint, or Outlook) that made a request for a stored process.

  The bottom line is that you'd have to code some tests, probably in a macro program inside your stored process. The full list of reserved macro variables differed in earlier versions of SAS. This is the list for 9.3 in the doc:

http://support.sas.com/documentation/cdl/en/stpug/62758/HTML/default/viewer.htm#p184mqqbi9w6qjn1q061...

cynthia

Quentin
Super User

Thanks Cynthia,

Looks like I can get most of the way by testing &_URL and &_MSOFFICECLIENT.

--Q.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

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
  • 2 replies
  • 844 views
  • 0 likes
  • 2 in conversation