NAs in sample

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

stefanp
Posts: 63
Joined: Wed Sep 30, 2015 12:24 am

NAs in sample

Postby stefanp » Wed Nov 14, 2018 8:24 am

I wish identify cross-sections in a panel data set if their value for a series at a certain time equals NA. I thought of something like

Code: Select all

smpl @all if series_a(@obsid=12)=na
show series_a


However, some cross sections of series_a are still being displayed besides having numeric value. Anything wrong with the sampling command?

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

Re: NAs in sample

Postby EViews Gareth » Wed Nov 14, 2018 8:34 am

Code: Select all

smpl time time if series_a = na


where time is the date you are interested in.
Follow us on Twitter @IHSEViews

stefanp
Posts: 63
Joined: Wed Sep 30, 2015 12:24 am

Re: NAs in sample

Postby stefanp » Wed Nov 14, 2018 8:44 am

I do not know if I can adopt that suggestion for what I need. My problem is a little more complex. In my pseudo-code below it should be something like

Code: Select all

smpl time time time(+12) time(+12) if and series_a(@obsid=time)=na and series_a(@obsid=time+12)<>na


I do not know if I can achieve that sampling with your suggestions.

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

Re: NAs in sample

Postby EViews Gareth » Wed Nov 14, 2018 9:05 am

I don't follow.
Follow us on Twitter @IHSEViews

stefanp
Posts: 63
Joined: Wed Sep 30, 2015 12:24 am

Re: NAs in sample

Postby stefanp » Wed Nov 14, 2018 9:19 am

I have a panel data set which contains monthly data for several years. However, I am primarily interested in two specific periods (before and after some policy change). Hence, I set the sample to these two periods:

Code: Select all

smpl 2012m01 2012m01 2013m01 2013m01


Additionally, I need to check how many of my cross sections have NAs in one period but not in the other period. Therefore:

Code: Select all

smpl 2012m01 2012m01 2013m01 2013m01 if series_a(2012m01)=na and series_a(2013m01)<>na


Since

Code: Select all

 if series_a(2012m01)=na
does not work, I replaced it with the corresponding obsid. Suppose that 2012m01 is the 12th month in my sample, i.e.

Code: Select all

smpl 2012m01 2012m01 2013m01 2013m01 if series_a(@obsid=12)=na and series_a(@obsid=24)<>na

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

Re: NAs in sample

Postby EViews Gareth » Wed Nov 14, 2018 9:37 am

For that specific case, I'd do:

Code: Select all

smpl 2013m1 2013m1 if series_a<>na and series_a(-12)=na
Follow us on Twitter @IHSEViews

stefanp
Posts: 63
Joined: Wed Sep 30, 2015 12:24 am

Re: NAs in sample

Postby stefanp » Wed Nov 14, 2018 10:14 am

But that does not allow me to look at the value of series_a in 2012m01. Is there any way to use a particular date as an index for a series (i.e., what I try to do with series_a(@obsid=12)?

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

Re: NAs in sample

Postby EViews Gareth » Wed Nov 14, 2018 10:15 am

No.

I still don't see what you're trying to do. If you just want a count,why do you need to see the series?
Follow us on Twitter @IHSEViews

stefanp
Posts: 63
Joined: Wed Sep 30, 2015 12:24 am

Re: NAs in sample

Postby stefanp » Thu Nov 15, 2018 1:02 am

Because I need to know the value of series_a in the other period, i.e. when it is not NA


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 14 guests