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.

BASUG is hosting free webinars Next up: Mike Sale presenting Data Warehousing with SAS April 10 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 892 views
  • 0 likes
  • 3 in conversation