SAS function Index() can be used for this purpose. The following statement will identify any records with the word 'PNEUMONIA' contained in the VARNAME variable.
where index(varname, 'PNEUMONIA')>=1;
if the word we need to find has mixed lower and upper cases, we can use the upcase() function.
where index(upcase(varname), 'PNEUMONIA')>=1;
How can I find things in a character variable in SAS?