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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1060 views
  • 0 likes
  • 2 in conversation