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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 4 replies
  • 457 views
  • 0 likes
  • 3 in conversation