Is there a way to avoid the warning for the following code? I'm not so much interested in a system option to turn off warnings, rather, I am curious as to whether or not there is a better way to write this query.
data quotey;
input string $9.;
cards;
shouldn't
wouldn't
couldn't
dont
won't
;
run;
proc print ; run;
ods html close; ods html ;
title 'Hmmm...';
proc sql ;
select * from quotey
where string like "%dn't%"
;quit;
You have a few different ways to handle this, but the simplest is to use
contains
instead oflike
. Of course that wouldn't work in all cases, but it would in yours.There are a lot of messy ways to handle it otherwise. The simplest is to use single quotes (to prevent macro resolution), but then you need to double your single quote/apostrophe.
You could also use
%nrstr
in a few ways (it prevents characters from being used to resolve a macro). Here's one.Here you have to double the
%
character (As it's used as an 'escape' sort of).