Page 1 of 1

Manipulating sample

Posted: Tue Nov 16, 2010 2:56 am
by Zividodo
Hello,

I have a sample in which any cell can obtain values between 1 and 4. I would like to change the values 1,3 and 4 into 0 and the value 2 into 1. Can anyone please give me a hint? I use Eviews 6.0

Thanks!

Re: Manipulating sample

Posted: Tue Nov 16, 2010 7:44 am
by startz
@recode

Re: Manipulating sample

Posted: Tue Nov 16, 2010 1:56 pm
by Zividodo
thank you, but how can use this command exactly?

lets assume, the initial variable is called X and I want to generate a new variable Z in order to obtain only values with 0 and 1. would then the command be

genr z = @recode (X=2, 1, 0)

?

Re: Manipulating sample

Posted: Sat Nov 27, 2010 3:18 am
by EViews Glenn
The manual should be pretty clear about how to use @recode. Since you only have 4 values that your original series can take, that should do what you want. Values of X equal to 2 are mapped to 1, and all others to 0.