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

Dear all

 

how can I find the value like “%{%}%”; “%[%]%” and “%(%)%” 

for example 

"{UMLAUT OVER (A)}"

"{UMLAUT OVER (E)}" 

"{UMLAUT OVER (O)}"

"{UMLAUT OVER (U)}" 

"{UMLAUT OVER (N)}" 

 

I use the following codes,

proc sql;
create table whichone as 
select distinct 
*
from step9.Patstat_gb_hrm_Step2
where HRM_L2_Step2 like ('%{%}%','%[%]%','%(%)%')
;
quit;

however,  I get a result like below,

928  proc sql;
929  create table whichone as
930  select distinct
931  *
932  from step9.Patstat_gb_hrm_Step2
933  where HRM_L2_Step2 like ('%{%}%','%[%]%','%(%)%')
                                     -
                                     22
                                     76
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, ), *, **, +, -, /, <, <=, <>,
              =, >, >=, ?, AND, BETWEEN, CONTAINS, EQ, EQT, GE, GET, GT, GTT, IN, IS, LE, LET, LIKE,
              LT, LTT, NE, NET, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.

ERROR 76-322: Syntax error, statement will be ignored.

934  ;
935  quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds

could you please give me some suggestions about this?

thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

I think you need to list multiple LIKE statements with an OR. 

LIKE does not have an IN type functionality to list multiple things at once. 

 

HRM_L2_Step2 like '%{%}%'
or HRM_L2_Step2 like '%[%]%' 
or HRM_L2_Step2 like '%(%)%'

 

Or you can try regular expressions. 

 


@Alexxxxxxx wrote:

Dear all

 

how can I find the value like “%{%}%”; “%[%]%” and “%(%)%” 

for example 

"{UMLAUT OVER (A)}"

"{UMLAUT OVER (E)}" 

"{UMLAUT OVER (O)}"

"{UMLAUT OVER (U)}" 

"{UMLAUT OVER (N)}" 

 

I use the following codes,

proc sql;
create table whichone as 
select distinct 
*
from step9.Patstat_gb_hrm_Step2
where HRM_L2_Step2 like ('%{%}%','%[%]%','%(%)%')
;
quit;

however,  I get a result like below,

928  proc sql;
929  create table whichone as
930  select distinct
931  *
932  from step9.Patstat_gb_hrm_Step2
933  where HRM_L2_Step2 like ('%{%}%','%[%]%','%(%)%')
                                     -
                                     22
                                     76
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, ), *, **, +, -, /, <, <=, <>,
              =, >, >=, ?, AND, BETWEEN, CONTAINS, EQ, EQT, GE, GET, GT, GTT, IN, IS, LE, LET, LIKE,
              LT, LTT, NE, NET, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.

ERROR 76-322: Syntax error, statement will be ignored.

934  ;
935  quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds

could you please give me some suggestions about this?

thanks in advance.


 

 

View solution in original post

2 REPLIES 2
Reeza
Super User

I think you need to list multiple LIKE statements with an OR. 

LIKE does not have an IN type functionality to list multiple things at once. 

 

HRM_L2_Step2 like '%{%}%'
or HRM_L2_Step2 like '%[%]%' 
or HRM_L2_Step2 like '%(%)%'

 

Or you can try regular expressions. 

 


@Alexxxxxxx wrote:

Dear all

 

how can I find the value like “%{%}%”; “%[%]%” and “%(%)%” 

for example 

"{UMLAUT OVER (A)}"

"{UMLAUT OVER (E)}" 

"{UMLAUT OVER (O)}"

"{UMLAUT OVER (U)}" 

"{UMLAUT OVER (N)}" 

 

I use the following codes,

proc sql;
create table whichone as 
select distinct 
*
from step9.Patstat_gb_hrm_Step2
where HRM_L2_Step2 like ('%{%}%','%[%]%','%(%)%')
;
quit;

however,  I get a result like below,

928  proc sql;
929  create table whichone as
930  select distinct
931  *
932  from step9.Patstat_gb_hrm_Step2
933  where HRM_L2_Step2 like ('%{%}%','%[%]%','%(%)%')
                                     -
                                     22
                                     76
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, ), *, **, +, -, /, <, <=, <>,
              =, >, >=, ?, AND, BETWEEN, CONTAINS, EQ, EQT, GE, GET, GT, GTT, IN, IS, LE, LET, LIKE,
              LT, LTT, NE, NET, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.

ERROR 76-322: Syntax error, statement will be ignored.

934  ;
935  quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds

could you please give me some suggestions about this?

thanks in advance.


 

 

PeterClemmensen
Tourmaline | Level 20
proc sql;
create table want as 
select distinct 
*
from have
where prxmatch('/{.*}|\[.*\]|(.*)/', HRM_L2_Step2);
quit;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 534 views
  • 2 likes
  • 3 in conversation