BookmarkSubscribeRSS Feed
jlcalbre
Calcite | Level 5
I ran into a situation where I wasn't getting the expected reults in a Proc SQL query. The line on my select statement was: "sum(case when table.name LIKE '%stove%' then 1 else 0 end) as TotalCount. I wasn't getting the correct results and discovered that the LIKE function is case-sensitive, causing the problem. However, I also discovered if I change the above line to "count(*) as TotalCount" and then use the like statement in the left join line: "LEFT JOIN table on table.id = root.id and table.name LIKE '%stove%' ", it isn't case-sensitive.

1st question, is there a way to make the LIKE function case-insenstive all the time? 2nd question, does anyone know why it would be case-sensitive in certain situations and not in others?
1 REPLY 1
Florent
Quartz | Level 8
Hi,

Using the following statement will probably fit with your needs:

sum(case when upcase(table.name) LIKE '%STOVE%' then 1 else 0 end) as TotalCount

Regards,
Florent

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 6756 views
  • 0 likes
  • 2 in conversation