I have a series called A (a1, a2, a3). What i want to do is if (a1,a2,a3) >65 then a new series B = (a1-65,a2-65,a3-65) generated; if not then the observation which below 65 returns 0. For example, A = (98,68,63) then B = (98-65,68-65,0)=(33,3,0). My code is like
if A > 65 then genr B = A-65 else genr B =0 endif
The problem is that the series B is always generated as all 0. Could you please suggest me how should I change this code? Thank you!!!
how should i write codes about this? Thank you!
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3797
- Joined: Wed Sep 17, 2008 2:25 pm
Re: how should i write codes about this? Thank you!
You want the @recode functionI have a series called A (a1, a2, a3). What i want to do is if (a1,a2,a3) >65 then a new series B = (a1-65,a2-65,a3-65) generated; if not then the observation which below 65 returns 0. For example, A = (98,68,63) then B = (98-65,68-65,0)=(33,3,0). My code is like
if A > 65 then genr B = A-65 else genr B =0 endif
The problem is that the series B is always generated as all 0. Could you please suggest me how should I change this code? Thank you!!!
Code: Select all
series b = @recode(a>65,a-65,0)Code: Select all
series b = (a>65)*(a-65) + (a<=65)*0Re: how should i write codes about this? Thank you!
It works very well! Thanks a lot!
Who is online
Users browsing this forum: No registered users and 2 guests
