Page 1 of 1

Recoding variables - everything becomes 'else use'

Posted: Wed Sep 20, 2023 1:18 pm
by alex99
Hi there,

it feels kinda stupid but I have a problem with recoding variables and I can't seem to find my mistake. I used a similar formula for recoding variables in a different dataset and there everything worked fine but now every cell gets filled with whatever I put in the "else use" collumn (in this case -9). I simply want to change the numbers from 1 -> 0 ; 2 -> 1 and -9 = -9.

The recode conditions read:
fx if $source == 0 use '1'
fx if $source == 1 use '2'
else use '-9'

Does someone know what my mistake could be?

Thank you in advance!

Re: Recoding variables - everything becomes 'else use'

Posted: Wed Sep 20, 2023 9:09 pm
by MAgojam
Hey @alex99,
what happens to you is due to the fact that the variable you want to recode is a Data type Text, but you are using it as if it were a Data type Integer.

The recoding conditions will be:
ScreenShot_20230920230642.jpeg
ScreenShot_20230920230642.jpeg (107.37 KiB) Viewed 6511 times
Cheers,
Maurizio

Re: Recoding variables - everything becomes 'else use'

Posted: Thu Sep 21, 2023 7:39 am
by alex99
Hi Maurizio,

yes, that was it - now everything works. Thank you so much for your quick help!

All the best
Alex