Page 1 of 1
NAs in sample
Posted: Wed Nov 14, 2018 8:24 am
by stefanp
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?
Re: NAs in sample
Posted: Wed Nov 14, 2018 8:34 am
by EViews Gareth
where time is the date you are interested in.
Re: NAs in sample
Posted: Wed Nov 14, 2018 8:44 am
by stefanp
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.
Re: NAs in sample
Posted: Wed Nov 14, 2018 9:05 am
by EViews Gareth
I don't follow.
Re: NAs in sample
Posted: Wed Nov 14, 2018 9:19 am
by stefanp
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
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
Re: NAs in sample
Posted: Wed Nov 14, 2018 9:37 am
by EViews Gareth
For that specific case, I'd do:
Code: Select all
smpl 2013m1 2013m1 if series_a<>na and series_a(-12)=na
Re: NAs in sample
Posted: Wed Nov 14, 2018 10:14 am
by stefanp
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)?
Re: NAs in sample
Posted: Wed Nov 14, 2018 10:15 am
by EViews Gareth
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?
Re: NAs in sample
Posted: Thu Nov 15, 2018 1:02 am
by stefanp
Because I need to know the value of series_a in the other period, i.e. when it is not NA