Hello,
In order to get a continuous sample to run an EGARCH regression, I'd like to replace the NAs by the last observation preceding the NA. How can I do that in Eviews 7 sv, please ?
Thanks in advance.
Replacing the NAs by the last observation preceding the NA
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Replacing the NAs by the last observation preceding the
I'm not going to comment on the econometric issues associated with doing what you propose, but if A is the original series and you want to create a new series Y that has A or the last valid value for A, the following should do it for you.
This assumes that the first observation for A is valid.
Code: Select all
series y=@recode(a=na, y(-1), a)
Re: Replacing the NAs by the last observation preceding the
Very good, it's ok
Thank you very much.
Re: Replacing the NAs by the last observation preceding the
This is a very useful tip, especially for those of us that import long series from external databases. I was wondering whether it would be possible to apply this command of filling NA values (either with lag, lead or 0 values) for all the series contained in the workfile simultaneously (i.e. a short script) and not just one-by-one.
P.S. Those kind of tricks may be a wonderful addition to a future update of EViews, they are real time savers!!
P.S. Those kind of tricks may be a wonderful addition to a future update of EViews, they are real time savers!!
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Replacing the NAs by the last observation preceding the
Code: Select all
%list = @wlookup("*", "series")
for %j {%list}
{%j} = @recode({%j}=NA, {%j}(-1), {%j})
next
Re: Replacing the NAs by the last observation preceding the
DONE! Thank you for your prompt response. Is there a manual for all the symbols and commands you used to write this loop? In data transformation process, there are several loops that one may find helpful. I know that there exist some, like "EViews 5 Command and Programming Reference" or "EViews j Illustrated", but I find them quite case-specific. Maybe an extensive command index with short examples?
For instance, how to generate new returns series (named 'ret_GDP') for all existing prices variables (named 'GDP') contained in the workfile. It may seem trivial for someone familiar with coding techniques, yet every software has its own language!
Thanks again for your helpful insights!
All the best!
For instance, how to generate new returns series (named 'ret_GDP') for all existing prices variables (named 'GDP') contained in the workfile. It may seem trivial for someone familiar with coding techniques, yet every software has its own language!
Thanks again for your helpful insights!
All the best!
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Replacing the NAs by the last observation preceding the
The Command and Programming Reference, available from the Help menu
Who is online
Users browsing this forum: No registered users and 2 guests
