BookmarkSubscribeRSS Feed
ncsthbell
Quartz | Level 8

I have done some research online and can not find any thing specific that explains how to do this, maybe it is not possible for SAS to handle.  Here is the situation:

 

I built a stored process that has 5 prompts available to the user.  The user wants to be able to pick any one or more of the promts.  Since they may or may not populate the prompts,  I did NOT define them as 'required' (in SMC).  I am checking the length on each of the prompts to determine if a value is present and building the 'where clause' using this method.

 

The caviot..... the user wants to make it a requirement that at least ONE of the prompts is populated and it doesn't matter which one.  If the run the stored process and have not entered any values, they would like a message returned that says  "At minimum one prompt value must be entered".  They would click 'ok' on this message box of just close it and be sitting at the same screen and be able to enter a value.

 

Can anyone tell me if this is possible to do in a SAS stored process?  If so, can you explain the method I could use?

 

Thanks!!!

3 REPLIES 3
Astounding
PROC Star

For the steps that are under your direct control, you can use a similar test to what you are using now:

 

%if %length(&prompt1 &prompt2 &prompt3 &prompt4 &prompt5) = 0 %then %do;

ncsthbell
Quartz | Level 8

Astounding,

Thank you for your reply.... After the "Then Do;"  is the method/code that I don't know how to handle 😞

Quentin
Super User

I don't think it's possible to do this with the default prompting interface.  I haven't used information delivery portal much, but I assume it is very similar to Stored Process Web App. 

 

With SPWA, the work around I have done is to let the stored process run, and then within the code in the stored process, verify that at least one macro variable has been populated with a value, and if that is false, write a simple html file to _webout delivering the error message "please check at least one value" or whatever.   I would think something like that could work from IDP.  With a little javascript, you could probably even pop up an alert box.

 

But that's not quite the same as having the prompt framework catch the input error and prevent the stored process from runnning.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1266 views
  • 0 likes
  • 3 in conversation