Panel data: Sample comprising all cross sections with no NAs in the selected date range

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

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

mamo
Posts: 205
Joined: Wed Nov 07, 2012 9:11 am

Panel data: Sample comprising all cross sections with no NAs in the selected date range

Postby mamo » Tue Jul 08, 2025 12:55 am

Hi everybody,
using EVIEWS 14. Question: How do you define a sample in panel data set so that the sample comprises all cross sections with no NAs in the selected date range?
See example in the files attached: If the selected data range is 2001 - 2010 only crossids 1 and 2 should be in the sample. With years 2000 - 2009 selected as date range, only crossids 1 and 3 should be in the sample. And if the selected date range is 2001 - 2009, all three crossids 1, 2 and 3 should be in the sample.
In the example which has only a small data set, this can be accomplished manually. However, with a large panel data set containing a large number of cross sections, a command or small program would be needed.
Best, mamo
Attachments
exampledata.wf1
(13.21 KiB) Downloaded 631 times
exampledata.png
exampledata.png (15.68 KiB) Viewed 194747 times

mamo
Posts: 205
Joined: Wed Nov 07, 2012 9:11 am

Re: Panel data: Sample comprising all cross sections with no NAs in the selected date range

Postby mamo » Tue Jul 08, 2025 3:34 am

Okay, I managed to find an approach that works:

Code: Select all

smpl 2001 2010 if @nasby(x, @crossid)=0 ' only crossids 1 and 3 are in the sample smpl 2000 2009 if @nasby(x, @crossid)=0 ' only crossids 1 and 2 are in the sample smpl 2001 2009 if @nasby(x, @crossid)=0 ' crossids 1, 2, and 3 are in the sample


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 0 guests