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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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