BookmarkSubscribeRSS Feed
filippo_kow
Obsidian | Level 7

 Hi guys,

 

I have a report that contains data for many companies, and I would like to add filter on the company. So I added drop-down list to my report with company values and assigned CompanyParameter to this list.

 

Now, I would like to show only exact values, I mean do something like this:

if company = 'CompanyParameter'p then show only records for CompanyParameter

 

Unfortunately when building the filter, I can't find 'equality' operator, I can use for example "Contains":

if company Contains 'CompanParameter'p then show only records for CompanyParameter

 

And here comes the main issue. Let's assume that I have two companies: ABC and ABCD. Because I have 'contains' operator, then when I select ABCD company the records for ABC will be also presented (because 'ABCD' contains 'ABC').

 

Do you know how should I resolve this issue?

 

 Thanks,

 Filip

1 REPLY 1
Sam_SAS
SAS Employee

Hello Filip,

 

You can use the "=" operator for both numeric and character values. It can be a little confusing because the hint text in the expression builder says "number".

 

For example:

 

IF ( 'car'n = 'Toyota' )
RETURN 1
ELSE 0

 

Beside the "=" operator, you could also use "In"

 

IF ( 'car'n In ('Toyota', 'Ford') )
RETURN 1
ELSE 0

 

Usually you would want to use In to match multiple values, but you can select a single value.

 

A tip about comparing character strings -- the comparison operators are case sensitive. So you would want to wrap the strings in the LowerCase() operator to make a case-insensitive match.

 

Sam

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 517 views
  • 0 likes
  • 2 in conversation