BookmarkSubscribeRSS Feed
BarryS_
Calcite | Level 5

When utilizing user prompts within a SAS EG Query Builder, how do you apply a SAS function such as taking the value that the user inputs and converting it to upper case prior to performing the filter operation?

I'm guessing I might need to take the user prompt out of Query Build and insert it into a user program in order to convert the user input to upper case and then feed that to the Query Builder step. I'm hoping someone has a good example and suggestion about how to accomplish this.

4 REPLIES 4
Kurt_Bremser
Super User

User prompts generate macro variables. The macro variable will then be used as "&name". Put upcase() around that: upcase("&name"). You will have to use the advanced filter option of the query builder.

BarryS_
Calcite | Level 5

I forgot to include a few important details about the type of prompt that I'm using which may complicate using the advanced filter option part of the Query Builder. 

I'm using a prompt type that allows for multiple values to be entered. Then I'm currently using that prompt in a basic filter where the operator is set to "In a list". As far as I can tell, the basic filter doesn't allow for specifying a SAS function, such as upcase. So, is there a way to use the advanced filter that you're suggesting with a prompt type that allows for multiple values and accomplish the same filter operation as the "In a list" operator in conjunction with the upcase function? 

jakarman
Barite | Level 11

It are still SAS macro vars altough they are in list. there is naming standard structure for that. Lokk what is done with those macro-vars. 

---->-- ja karman --<-----
Kurt_Bremser
Super User

The prompt defines macro variables. These are used in the Query Builder. Use the advanced option (where you can enter conditions manually) to enter the upcase function. In case you get a condition like "variable in (&list)", you can use %upcase(&list).

Or take the code generated by the Query Builder, put it into a separate Code Object and edit there.

Advanced SAS usage needs SAS programming, anyway. So use the code generated by the wizards in EG as a starting point.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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