Is this the casting error?


Is this the casting error?


I am trying to write some SAS codes in Teradata. There is one condition in my code :


So, the thing is when I am removing this condition from SAS and Teradata, the results are exact match to the decimal places, but after putting this condition I am getting differences between the result.

PS: avg_depth=sum(x)/sum(y)

I have casted sum(x) and sum(y) to decimal(18,6)

Junior Contributor

Re: Is this the casting error?

You might check the avg_depth of the missing rows if it's close to zero:

 < 0.0000005 will be rounded to 0

SAS might use FLOAT arithmetics, so you could try avg_depth=cast(sum(x) as float)/sum(y)


Re: Is this the casting error?

hi dnoeth,

I have data like 123456*12 ..I need data before * as one column and after * as other column ..but when i run below statement its throwing me an error 2662..Please help.

cast(substring(ID from 1 for instr(ID,'*',1)-1) as int) as cust_num


Re: Is this the casting error?

select substring(ID from 1 for index(ID, '*')-1), substring(ID from index(ID, '*')+1 for char_length(ID))