Hello,
I was trying to get more information on how the 'recode' command works in EViews: logic behind; structure - is it similar to Excel's 'IF' function (condition, if true, if false); is a value of 1 = True and 0 = False; etc. Couldn't find any extended info in the EViews manuals.
Also, if you could tell me what the following code does would be greatly appreciated:
series ud = @recode(@isna(ud(-1)), ud_code = "Y", ud(-1)=1 or ud_code = "Y").
Thank you.
'Recode' functionality
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: 'Recode' functionality
Yep, works same was as IF in Excel.
That's a bit of a crazy expression, but what it does is:
If the lagged value of UD is an NA, then set the values of UD equal to the expression UD_CODE="Y".
If the lagged value of UD is not an NA, then set the values of UD equal to the expression UD(-1)=1 or UD_CODE="Y".
The expression UD_CODE="Y" will return either a 1 or a 0 depending on whether the alpha series UD_CODE is equal to "Y" or not.
The expression UD(-1)=1 or UD_CODE="Y" will return either a 1 or a 0 depending jointly on whether the lagged value is equal to 1, or UD_CODE is equal to "Y".
So you'll end up with a series of 1s or 0s.
Code: Select all
series ud = @recode(@isna(ud(-1)), ud_code = "Y", ud(-1)=1 or ud_code = "Y")
If the lagged value of UD is an NA, then set the values of UD equal to the expression UD_CODE="Y".
If the lagged value of UD is not an NA, then set the values of UD equal to the expression UD(-1)=1 or UD_CODE="Y".
The expression UD_CODE="Y" will return either a 1 or a 0 depending on whether the alpha series UD_CODE is equal to "Y" or not.
The expression UD(-1)=1 or UD_CODE="Y" will return either a 1 or a 0 depending jointly on whether the lagged value is equal to 1, or UD_CODE is equal to "Y".
So you'll end up with a series of 1s or 0s.
Re: 'Recode' functionality
Thank you very much, Gareth! Just what I was looking for.
Who is online
Users browsing this forum: No registered users and 2 guests
