=:
не является оператором like
или contains
.Скорее, это оператор «начинается с».В вашем случае он ищет точный префикс «Comm» при чтении строки слева направо.Вместо этого используйте index()
, чтобы найти определенный набор слов или подстрок в строке.Вот несколько примеров:
data _null_;
length word $25.;
put 'String: Communications';
String = 'Communications';
if(String =: 'Comm') then put 'The string starts with "Comm"';
put 'String: Global Communications';
String = 'Global Communications';
if(String =: 'Glob') then put 'The string starts with "Glob" and not "Comm"';
if(index(String, 'Comm') ) then put 'The string contains "Comm"';
run;