Naz
Naz

Reputation: 1

How to find if any of the values in a range of variable contains a specific string

So I have a range of variables that were created by transposing the long-format data to wide-format. For example, result1-result13. Now I want to find if any of the results between 1-10 is 'positive'. Is there ANY shortcut function in SAS. I tried ANY function but it said it was unknown to SAS lol.

Help please. Thanks.

Upvotes: 0

Views: 1216

Answers (1)

Joe
Joe

Reputation: 63434

The whichc function is probably what you're looking for.

found = whichc('positive', of result1-result13);

whichc tells you which of the arguments is the first to contain the first string, or 0 if none do.

Upvotes: 1

Related Questions