BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jenim514
Pyrite | Level 9

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.
1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

Try in

 

  if patrank in : ('E','W','O','C','U') then do;

View solution in original post

2 REPLIES 2
novinosrin
Tourmaline | Level 20

Try in

 

  if patrank in : ('E','W','O','C','U') then do;
ballardw
Super User

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.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1598 views
  • 1 like
  • 3 in conversation