Your SAS programs, embedded in web apps and elsewhere

Setting a Text Prompt to an initial value based on a macro variable

Reply
Occasional Contributor
Posts: 9

Setting a Text Prompt to an initial value based on a macro variable

Hi,

I have a stored process presented to it's users via the portal (IDP). One of the prompts is for a SAS/Connect userid (which is generally the same as the users portal login and therefore available via the _USERNAME reserved macro variable in the STP server on execution.)

Is there any way to assign an initial value to a text prompt in a stored process using the _USERNAME macro var? (or any macro var?) I've tried using a %let to assign the prompt macro var the value of _USERNAME as well as &_USERNAME in the default value of the prompt properties to no avail.

I could create a dataset in metadata with one var/one row and use that to populate a default value at the beginning of the stored process but that seems over-complicated to me.

Any suggestions/comments appreciated.

Thanks,
Graham.
SAS Employee
Posts: 284

Re: Setting a Text Prompt to an initial value based on a macro variable

Is this for SAS 9.1 or SAS 9.2?

Vince DelGobbo
SAS R&D
Occasional Contributor
Posts: 9

Re: Setting a Text Prompt to an initial value based on a macro variable

It's 9.2 ....
SAS Employee
Posts: 284

Re: Setting a Text Prompt to an initial value based on a macro variable

I tried to do this using a dynamic prompt, but was unable to get it to work.

Another possible solution is to build a prompt page yourself, but note that this will only work if the stored process is executed using the SAS Information Delivery Portal or the SAS Stored Process Web Application.

The technique involves executing a stored process that writes the HTML-based prompt to _WEBOUT. Below is a snippet of code to get you started.

[pre]
data _null_;
file _webout;
put '
';
put '';
put 'Enter your SAS/CONNECT userid:';
put '';
put '<br>';
put '';
put '
';
run;
[/pre]

Vince DelGobbo
SAS R&D
Occasional Contributor
Posts: 9

Re: Setting a Text Prompt to an initial value based on a macro variable

Thanks for your help, Vince. I was kind of hoping that you'd tell me that there was some kind of trick to force it to be recognised .... Never mind. Perhaps this could get added to the developers' New Year 'To Do List' ?! Smiley Happy

Thanks for the snippet of code to get started down the other path, though.

All the best for the holiday season and a good New Year when it comes,

Graham.
Ask a Question
Discussion stats
  • 4 replies
  • 325 views
  • 0 likes
  • 2 in conversation