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

Can someone please tell me why the following code doesn't work as an expression in the mapping tab of a DI Studio transformation?

case EMAIL

  when not contains "@" then NULL

  when contains "æ" then NULL

  when contains "ø" then NULL

  when contains "å" then NULL

  else EMAIL

end

I get this error message: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, , =, , =, >, >=, ?, AND, CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
LinusH
Tourmaline | Level 20

NULL has just a meaning when it comes to boolean expression, it's not a value that you can use in an assignment.
...

when email not contains "@" then ' '

...

Data never sleeps

View solution in original post

4 REPLIES 4
LinusH
Tourmaline | Level 20

When you hace specified a column at the case, you can't use expressions that implies the column at the bueginning of the expression.

Move EMAIL to each when statment to keep the logic.

Data never sleeps
TurnTheBacon
Fluorite | Level 6

Thanks. I seem to get the exact same error message when I try the following code though. Can you see what's wrong?

case

  when EMAIL not contains "@" then NULL

  when EMAIL contains "@." then NULL

  when EMAIL contains "æ" then then NULL

  when EMAIL contains "ø" then NULL

  when EMAIL contains "å" then NULL

  else EMAIL

end

LinusH
Tourmaline | Level 20

NULL has just a meaning when it comes to boolean expression, it's not a value that you can use in an assignment.
...

when email not contains "@" then ' '

...

Data never sleeps
TurnTheBacon
Fluorite | Level 6

Problem solved. Many thanks!

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 connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 2423 views
  • 3 likes
  • 2 in conversation