stomna(AFG,Mat1)
scalar X50 = @quantile(Mat1,0.5)
scalar X60 = @quantile(Mat1,0.6)
scalar X70 = @quantile(Mat1,0.7)
scalar X80 = @quantile(Mat1,0.
scalar X90 = @quantile(Mat1,0.9)
series AFG_90 = 0
series AFG_80 = 0
series AFG_70 = 0
series AFG_60 = 0
series AFG_50 = 0
series AFG_90 = @recode(X90 <= AFG , AFG, 0)
series AFG_80 = @recode(X80 <= AFG < X90, AFG, 0)
series AFG_70 = @recode(X70 <= AFG < X80, AFG, 0)
series AFG_60 = @recode(X60 <= AFG < X70, AFG, 0)
series AFG_50 = @recode( AFG < X60, AFG, 0)
AFG_90 is correct. All the remaining series are identical and simply return the original series. (AFG_80 = AFG70=AFG60=AFG50=AFG)
To get this to work, I had to convert the series to matrix
vector (nnob) sto90
vector (nnob) sto80
vector (nnob) sto70
vector (nnob) sto60
vector (nnob) sto50
for !t = 1 to nnob
if Mat1(!t) >= x90 then
sto90(!t) = Mat1(!t)
else
sto90(!t) = 0
endif
if x80 <= Mat1(!t) and Mat1(!t) < x90 then
sto80(!t) = Mat1(!t)
else
sto80(!t) = 0
endif
if x70 <= Mat1(!t) and Mat1(!t) < x80 then
sto70(!t) = Mat1(!t)
else
sto70(!t) = 0
endif
if x60 <= Mat1(!t) and Mat1(!t) < x70 then
sto60(!t) = Mat1(!t)
else
sto60(!t) = 0
endif
if Mat1(!t) < x60 then
sto50(!t) = Mat1(!t)
else
sto50(!t) = 0
endif
next
mtos(sto90,AFG_90)
mtos(sto80,AFG_80)
mtos(sto70,AFG_70)
mtos(sto60,AFG_60)
mtos(sto50,AFG_50)
@recode issue
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- EViews Developer
- Posts: 564
- Joined: Thu Apr 25, 2013 7:48 pm
Re: @recode issue
Hello,
The issue is the expressions used in the @recode statements for AFG_80, AFG_70, and AFG_60. You cannot test whether a value is within a range using an expression such as "X80 <= AFG < X90". Instead, use two conjoined relational expressions, i.e. "X80 <= AFG and AFG < X90", or the @between function, i.e. "@between(AFG, X80, X90)".
The issue is the expressions used in the @recode statements for AFG_80, AFG_70, and AFG_60. You cannot test whether a value is within a range using an expression such as "X80 <= AFG < X90". Instead, use two conjoined relational expressions, i.e. "X80 <= AFG and AFG < X90", or the @between function, i.e. "@between(AFG, X80, X90)".
Who is online
Users browsing this forum: No registered users and 25 guests