Matteo Felici
Matteo Felici

Reputation: 1107

SAS FedSQL - regular expression

I'm trying to use a regular expression inside the SAS Data Flux client, which uses Fed SQL. The code is like this:

select * from dataset
where char_value LIKE "ICM[DEF].*"

in order to match all the records where char_value = ICMD... or ICME... or ICMF... . It doesn't seem to understand the regex, in fact it returns 0 rows.Can you help me?

Upvotes: 0

Views: 389

Answers (1)

sagi
sagi

Reputation: 40491

After looking online for sas synatax, I saw that you are not using the correct syntax.

LIKE operator should be with singlee quotes if you are matching a string, and use % not * so:

select * from dataset
where char_value LIKE 'ICM[DEF]%'

Its untested, so tell me if it works(I'm not familiar with [] so if it doesn't work you can try like 'ICMD.%' or like 'ICME.%'....)

select * from dateset
where char_value like 'ICMD%' or char_value like 'ICME%' or char_value like 'ICMF%'

Upvotes: 1

Related Questions