Sample starting from last non-missing observation

For questions regarding programming in the EViews programming language.

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

bjohn
Posts: 15
Joined: Fri Mar 11, 2011 8:13 am

Sample starting from last non-missing observation

Postby bjohn » Mon Mar 28, 2011 9:37 am

I have a dated, quaterly workfile. I want to use the "smpl" command to make my sample start at the last non-missing observation of a variable x.

Using @ilast(x) gives me the observation ID, rather than the date of the observation. Typing "smpl @ilast(x) @end" therefore yields an "illegal date" error message.

Is there a simple way to tell eviews to begin the sample at the last known value of variable x?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13603
Joined: Tue Sep 16, 2008 5:38 pm

Re: Sample starting from last non-missing observation

Postby EViews Gareth » Mon Mar 28, 2011 9:41 am

You can use @otod to convert the observation ID into a date string. You can then put that string into the sample statement.

bjohn
Posts: 15
Joined: Fri Mar 11, 2011 8:13 am

Re: Sample starting from last non-missing observation

Postby bjohn » Mon Mar 28, 2011 9:46 am

If I type smpl @otod(@ilast(x)) 2010Q4, I still get the illegal date message!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13603
Joined: Tue Sep 16, 2008 5:38 pm

Re: Sample starting from last non-missing observation

Postby EViews Gareth » Mon Mar 28, 2011 9:52 am

Code: Select all

%start = @otod(@ilast(x)) smpl {%start} 2010q4


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests