Dear Statlist community,

Despite being a very simple question, I did not figure how to perform this command through my textbook or by reading previous topics by searching through this forum. If this has been discussed earlier, I would be very grateful if someone could redirect me.

I have huge datasets where I want to check for groups of specific string-values in a specific variable. This can be done by "list in if variable == "value"", but this seems to be very ineffective, time-consuming, and computationally expensive. Also, in many instances, I want only to check if the value contains a set of letters at the beginning of the string value. An example can be that I want to check for whether the variable icd_10 in a certain dataset contains the value of C31 (but this can typically contain values of C310, C311, C312, etc - but I want to check C30 as a group).

Kind regards,
Haakon