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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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