SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Why doesn't this case-expression work in DI Studio?

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 89
Accepted Solution

Why doesn't this case-expression work in DI Studio?

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.


Accepted Solutions
Solution
‎12-11-2012 06:02 AM
Super User
Posts: 5,256

Re: Why doesn't this case-expression work in DI Studio?

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


All Replies
Super User
Posts: 5,256

Re: Why doesn't this case-expression work in DI Studio?

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
Frequent Contributor
Posts: 89

Re: Why doesn't this case-expression work in DI Studio?

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

Solution
‎12-11-2012 06:02 AM
Super User
Posts: 5,256

Re: Why doesn't this case-expression work in DI Studio?

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
Frequent Contributor
Posts: 89

Re: Why doesn't this case-expression work in DI Studio?

Problem solved. Many thanks!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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