Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I'd like to calculate average of string variable.
I have the variable: Less, the same and More
I'd like to recode them to -1, 0 and 1 in expression
Is it possible to do it in the expression
Avg(IF(DDD='Less', -1, IF(DDD='the same', 0, IF(DDD='More', 1))) DDD)
Cheers,
avg(pick(match(DDD,'Less','Same amount','More'),-1,0,1))
It works
Thanks.
Try
Avg(Match(DDD, 'Less', 'the same', 'More)-2)
Eduardo
If this doesn't work, do the conversion in the load script.
Eduardo
avg(pick(match(DDD,'Less','Same amount','More'),-1,0,1))
It works
Thanks.