Removing duplicates in panel data

For questions regarding programming in the EViews programming language.

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

paues
Posts: 218
Joined: Fri Apr 15, 2011 7:16 am
Location: Stockholm, Sweden

Removing duplicates in panel data

Postby paues » Wed Sep 05, 2012 2:18 am

I have a work file with a undated panel (see attached example). Unfortunately it contains quite a few duplicates. How would I remove the superfluous entries?
Attachments
example.wf1
(8.98 KiB) Downloaded 308 times

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

Re: Removing duplicates in panel data

Postby EViews Gareth » Wed Sep 05, 2012 7:56 am

How are you defining a duplicate?

paues
Posts: 218
Joined: Fri Apr 15, 2011 7:16 am
Location: Stockholm, Sweden

Re: Removing duplicates in panel data

Postby paues » Wed Sep 05, 2012 8:02 am

Two observations with identical values for all variables.

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

Re: Removing duplicates in panel data

Postby EViews Gareth » Wed Sep 05, 2012 8:07 am

Can't think of an easy way to do it. This might get you most of the way there:

Code: Select all

pagecontract if country<>country(-1) or flow<>flow(-1) or value<>value(-1) or year<>year(-1) or @trend=0
Make sure you have a backup before trying it though!

paues
Posts: 218
Joined: Fri Apr 15, 2011 7:16 am
Location: Stockholm, Sweden

Re: Removing duplicates in panel data

Postby paues » Wed Sep 05, 2012 8:16 am

If preceded by

Code: Select all

sort country flow value year
your code should settle it, don't you think?

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

Re: Removing duplicates in panel data

Postby EViews Gareth » Wed Sep 05, 2012 8:22 am

probably.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest