lundi 20 février 2017

Search similar pattern in strings in SAS

I have a list of char variables in SAS and I need to find lines with similar pattern. I know I can use functions like SPEDIS or COMPGED, but those do not work in my case. I hope the example below will help to understand better what I want. Let's say I have the following lines:

JamesBond
StonerSteve
JamesBondLondon
JamesB+City
AlJamesBondian
JamesSuli
James
Jones

The thing is that I need to identify all records with JamesB no matter where this fragment is (in the beginning, middle or end of the string). And I do not know that I am looking specifically for JamesB fragment (just illustration of a pattern). SPEDIS or COMPGED works well, but if the length is very different, those functions give a confusion outcome. Is there an easy way to do it?

Aucun commentaire:

Enregistrer un commentaire