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
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
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.