How to run the program for Sampled year only and get result
Posted: Wed Jan 17, 2018 2:13 am
I am an EViews10 user.
I have a series from 1990 to 2050, which has mix set of values, 0, positive and negative.(attached work file). I want to check the values inside series for each year from 2022 to 2050 separately and publish result as passed if value is positive and failed if negative.
I have tried using both these methods, but no luck. Every time, this code runs, even after taking sample, the condition run for entire series from 1990 to 2050 and not for one single year, and publish result as "passed" even for negative value years.
Please help how to run the program only for the sampled year and get the desired result.
Method 1:
logmode logmsg
smpl 1990 2050
eth_apd_ag = @recode(eth_apd_ag=NA,0,eth_apd_ag)
for !y = 2022 to 2050
smpl !y !y
if eth_apd_ag<0 then
logmsg failed for year !y
else
logmsg passed for year !y
endif
next
Method 2:
logmode logmsg
smpl 1990 2050
eth_apd_ag = @recode(eth_apd_ag=NA,0,eth_apd_ag)
for !y = 2022 to 2050
smpl 1990 2050
%sname = "Ser" + @str(!y)
series {%sname} = @recode(eth_apd_ag>0,1,0)
smpl !y !y
if {%sname}=0 then
logmsg failed for year !y
else
logmsg passed for year !y
endif
next
I have a series from 1990 to 2050, which has mix set of values, 0, positive and negative.(attached work file). I want to check the values inside series for each year from 2022 to 2050 separately and publish result as passed if value is positive and failed if negative.
I have tried using both these methods, but no luck. Every time, this code runs, even after taking sample, the condition run for entire series from 1990 to 2050 and not for one single year, and publish result as "passed" even for negative value years.
Please help how to run the program only for the sampled year and get the desired result.
Method 1:
logmode logmsg
smpl 1990 2050
eth_apd_ag = @recode(eth_apd_ag=NA,0,eth_apd_ag)
for !y = 2022 to 2050
smpl !y !y
if eth_apd_ag<0 then
logmsg failed for year !y
else
logmsg passed for year !y
endif
next
Method 2:
logmode logmsg
smpl 1990 2050
eth_apd_ag = @recode(eth_apd_ag=NA,0,eth_apd_ag)
for !y = 2022 to 2050
smpl 1990 2050
%sname = "Ser" + @str(!y)
series {%sname} = @recode(eth_apd_ag>0,1,0)
smpl !y !y
if {%sname}=0 then
logmsg failed for year !y
else
logmsg passed for year !y
endif
next