BookmarkSubscribeRSS Feed
SASDump
Calcite | Level 5
I am using the EG 4.3 query builder to select and filter data from dataset for generating report with parameter prompt.

The parameter required will be ad-hoc SQL command e.g. year = 2009 and month = 1

i able to perform such ad-hoc SQL when the parameter is entered, but get error when the parameter is left empty. I know there is an option for "Required non-blank variable" in the parameter prompt, by checking this the parameter cannot be left blank before submitting. But if i want to allow it to be blank, is there any workaround or trick for doing such magical query?

I now assigned a "cond" variable for the ad-hoc condition and setting the filter = &cond for performing such ad-hoc query. i have tried using case when &cond ='' then 1=1 else &cond end but fail with error.

Any one has idea to this problem? Thanks in advance!
1 REPLY 1
jklaverstijn
Rhodochrosite | Level 12
Maybe your case construct will work with a small adaptation. Use quotes like:

case when "&cond" ='' then 1=1 else &cond

Good luck.
- Jan.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1 reply
  • 1124 views
  • 0 likes
  • 2 in conversation