Hi!
I am trying to identify all values that do not begin with certain letters...and set them to missing.
if patrank ne: ('E','W','O','C','U') then do;
patrank='';
end;
THis gave me an error...
3616 if patrank ne: ('E','W','O','C','U') then do;
- --
388 180
200
ERROR 388-185: Expecting an arithmetic operator.
ERROR 180-322: Statement is not valid or it is used out of proper order.
ERROR 200-322: The symbol is not recognized and will be ignored.
3617 patrank='';
3618 end;
---
161
ERROR 161-185: No matching DO/SELECT statement.
Try in
if patrank in : ('E','W','O','C','U') then do;
Or:
data example;
input patrank $;
if not ( patrank in : ('E','W','O','C','U') ) then call missing(patrank);
datalines;
This
Other
words
Can
use
Word
case
;
run;
is the comparison supposed to be case sensitive? If you want to match "case" as well as "Can" then use upcase(patrank) in the comparison.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.