Coding to Return Different Values

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

RPEDC
Posts: 7
Joined: Wed Aug 28, 2013 11:43 am

Coding to Return Different Values

Postby RPEDC » Wed Sep 04, 2013 8:06 am

Hello,

I'm working on a program where I have a series of countries where each country has two variables that I want to create an identity out of. I'd also like to write the program so it returns "NA" if the identity equals one of the values (I know that some of the countries are missing the second piece of data). What I coded is below, but it's not quite working out. I'm wondering anyone has some suggestions.

Code: Select all

for %i USA AFG ALB ALG ANG AGL ANT ARG ARM ARU AUST ASTR AZE BAHA BHR BAN BAR BYE BEL BELI BEN CAN COL COM CON ZAI FIN FRA smpl @all series {%i}_A_B = na smpl if {%i}_A_B = na genr {%i}_A_B = {%i}_A - {%i}_B if {%i}_A_B ={%i}_A then {%i}_A_B= NA endif next

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: Coding to Return Different Values

Postby startz » Wed Sep 04, 2013 8:16 am

something like

Code: Select all

{%i}_A_B = @recode({%i}_A_B ={%i}_A, na, {%i}_A_B)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests