BookmarkSubscribeRSS Feed
CTT53
Calcite | Level 5

I am trying to add a "Case When" statement to my table with contains.  I have 2 stings that are alike and it calculates both.  How do I distinguish

 

1)  Review and Discussion

2)  Review and Discussion Client

 

Thanks

 

4 REPLIES 4
Amir
PROC Star

Hi,

 

Can you avoid using the contains operator and use the eq (equals) operator instead for the first case?

 

 

Regards,

Amir.

 

CTT53
Calcite | Level 5

I tried that however I am trying to count the occurrence of each time it appear.   There are approx. 40 other descriptions that in the row. 

 

Amir
PROC Star

Hi,

 

I think it would be useful if you shared your code (or a sample we can run) with some data in the form of a data step with datalines that we can also run to create the data.

 

Would the count function help?:

 

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002260230.htm

 

 

Regards,

Amir.

SuryaKiran
Meteorite | Level 14

Simply igore the one you don't want to count

 

Find(var,"Review and Discussion",'i')>0 and Find(var,"Review and Discussion Client",'i')=0 then Count+1;

Thanks,
Suryakiran

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1225 views
  • 0 likes
  • 3 in conversation