Desktop productivity for business analysts and programmers

How do you convert input from a SAS EG user prompt to upper case prior to performing Query Builder filter operation?

Reply
New Contributor
Posts: 4

How do you convert input from a SAS EG user prompt to upper case prior to performing Query Builder filter operation?

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.

Super User
Posts: 7,379

Re: How do you convert input from a SAS EG user prompt to upper case prior to performing Query Builder filter operation?

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 4

Re: How do you convert input from a SAS EG user prompt to upper case prior to performing Query Builder filter operation?

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? 

Valued Guide
Posts: 3,208

Re: How do you convert input from a SAS EG user prompt to upper case prior to performing Query Builder filter operation?

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 --<-----
Super User
Posts: 7,379

Re: How do you convert input from a SAS EG user prompt to upper case prior to performing Query Builder filter operation?

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 4 replies
  • 1089 views
  • 0 likes
  • 3 in conversation