I am trying to find following value in
('BLACK','BF','CYBER','PRE WEEK')
in event_name and wrote the code
if find(upcase(event_name),('BLACK','BF','CYBER','PRE WEEK')) AND find(upcase(season ),'AW') then EVENT_FLAG='CLEARANCE';its showing following error
32 if find(upcase(event_name),('BLACK','BF','CYBER','PRE WEEK')) AND find(upcase(season ),'AW') then EVENT_FLAG='CLEARANCE';
_ _
79 22
200
____
72
ERROR 79-322: Expecting a ).
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, ;, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT,
IN, LE, LT, MAX, MIN, NE, NG, NL, NOT, NOTIN, OR, THEN, ^, ^=, |, ||, ~, ~=.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 72-185: The FIND function call has too many arguments.Can some one help so I can search all these string.
if upcase(event_name) in ('BLACK','BF','CYBER','PRE WEEK') AND upcase(season) in ('AW') then EVENT_FLAG='CLEARANCE';
You aren't telling us clearly what kind of logic you're trying to implement, nor this is apparent from your code. Let's see:
1. If, as you say, you want to find whether the entire string value 'BLACK','BF','CYBER','PRE WEEK' (replete with the single quotes) is contained in upcase(event_name), then:
if find (upcase (event_name), "'BLACK','BF','CYBER','PRE WEEK'") and ...
2. On the other hand, if (as I strongly suspect), you want to find If EVENT_NAME contains any of the strings 'BLACK','BF','CYBER','PRE WEEK', then:
if (find (upcase (event_name), 'BLACK')
or find (upcase (event_name), 'BF')
or find (upcase (event_name), 'CYBER')
or find (upcase (event_name), 'PRE WEEK')
) and ...
3. If you want to find If EVENT_NAME contains any of the words 'BLACK','BF','CYBER','PRE WEEK', then use the FINDW function instead of FIND.
Kind regards
Paul D.
if prxmatch('/BLACK|BF|CYBER|PRE WEEK/i',even_name) then .....
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!
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.