SAS day 49:
Background story:
Where doing safety analysis, sometimes we need to look into the drug relations with Special Interest Adverse Events, which are similar, such as “Glaucoma” and “Glaucosis”.

cocoparisienne / Pixabay
While investigating into these special interest events, instead of using AESI in (“x”, “y”,”z” ) we prefer a more robust way.
Tool:
Where.. Like.. this expression can generate similar outputs.
Basic Syntax:
data a; set b; where x like "y%"; run;
Example:
-
Brand begins with A
*1.Brand begins with A; data begin_a; set cars; where Make like "A%"; run;
2.Brand begins with A followed by 3 characters
data begin_a; set cars; where Make like "A___"; *follow by 3 characters; run;
3.letter in between
data twodoor; set cars; where model like "%2dr%"; run;
4.In the end
data car_end; set cars; where make like "%t"; run;
5.Multiple conditions
data car_end; set cars; where make like "%t" and model like "%2dr%" ; run;
Alternative solution:
Proc SQL works well,too.
proc sql;
create table a
select x where y like “a%” from data;
quit;
Happy SAS Coding!