Your SAS programs, embedded in web apps and elsewhere

Pass &_CLIENTPROJECTNAME to stored process called from EG?

Super Contributor
Posts: 376

Pass &_CLIENTPROJECTNAME to stored process called from EG?

SAS 9.3 on Windows




I have a test stored process with these options:


SAS Code:  

proc print data=sashelp.class;run;



%put _all_;


Execution Options:

Default server (Workspace server only also works)

Allow execution on other application servers (so source code in metadata)

Result capabilities: Package (only)


This stored process has other prompts, and is only called from EG.


Is there a way to pass the &_CLIENTPROJECTNAME (i.e. the name of the *saved* EG project) to this stored process?  I tried a hidden prompt, didn't work.




Posts: 60

Re: Pass &_CLIENTPROJECTNAME to stored process called from EG?

Hi ScottBass, 

Can you provide more info? Like, where are you using that macro variable in your stored process and for what purpose? If the value is null (user hasn't saved the EG project) you may be seeing things correctly.

Super Contributor
Posts: 376

Re: Pass &_CLIENTPROJECTNAME to stored process called from EG?

Hi Michelle,


I'm building a crude UI for my EG project using stored processes.


1) The prompt manager built into EG does not meet my needs; it does not have all the prompting capabilities available in stored processes.


2) My stored process must run under either the Default server or Workspace server only; if it runs under the stored process server there are access problems with certain directories due to NTFS permissions (that will not change).  With either selection, the stored process runs under the credentials of the logged in user, but in a different workspace server session than the EG project.  IOW, if the stored process creates the macro variable foo, &foo is not available in later processing in the EG project (at least not without some work - see below).


3) Based on the selections the user makes from the UI, different logic branches are selected in the EG project.


4) The workspace servers spawned by the stored process are transient, existing only for the duration of the stored process.  In this respect, they are "stateless", somewhat analogous to browser/server interactions.


5) To get my processing to work, I'm creating a parameters dataset, saving the values that the user has selected from the stored process prompts.  I think of the parameters dataset as somewhat analogous to cookies in the browser.


6) I've got this working OK for a single project.  However, my initial design was flawed, in that the user might work on multiple projects at one time.  I don't want the parameters selected from one project to override the selections from another project.  So, I need a key for the parameters dataset.  Client project name would be a good key.  Somewhat analogous to different cookies for different websites, even if coincidentally those cookies contain similar information.


So, I need to pass the CLIENTPROJECTNAME to the stored process, so that the stored process can store this in the parameters dataset.  It's unfortunate that a stored process called from EG doesn't automatically know the project name that called it (although _CLIENTNAME=SAS Enterprise Guide).  I did a %put _all_ from my stored process code but didn't see anything that would help in this scenario.


If the prompting built in to EG supports:  selection-dependent groups, shared storage of a group of prompts as a unit, the ability to store the source code in a central location (preferably metadata server but will accept an external file), changing the shared prompts changes the prompts in all projects that reference those prompts (IOW central storage of prompts and supporting code), etc, etc, then I'll happily change to EG prompting.  


But from what I can see, EG prompting is the poor cousin to the prompting available in stored processes.  So I'm having to jump through hoops to get EG to display acceptable prompting for my needs.


Posts: 60

Re: Pass &_CLIENTPROJECTNAME to stored process called from EG?

Thanks for elaborating. That is tough. I was thinking SYSJOBID would help but that seems to be the process id from the workspace server and is getting reset with every submission. I still don't think &_CLIENTPROJECTNAME is going to work if the user opens multiple EG sessions without saving the project, you'll have a value of null in every case. I cannot think of a way to uniquely identify an EG session.

Ask a Question
Discussion stats
  • 3 replies
  • 2 in conversation