Stacking raw data - help

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

Chthoniid
Posts: 24
Joined: Mon Oct 22, 2012 6:02 pm

Stacking raw data - help

Postby Chthoniid » Wed Apr 27, 2016 7:24 pm

Hi all- I'm on Eviews 9 for the first time.

I'm trying to import data in a very irregular format, and shape it into something I can work with. It's not working.

The data records the number of butterflies caught by each collector in each village in PNG.
E.g.
Date YR Collector Town Q P TR
26 August 1993 1993 KEREU LAWAT Lorengau 15 2.5 37.5
26 August 1993 1993 KEREU LAWAT Lorengau 24 1.5 36
26 August 1993 1993 KEREU LAWAT Lorengau 12 0.2 2.4
26 August 1993 1993 KEREU LAWAT Lorengau 6 0.2 1.2
24 February 1993 1993 Michael Ndrih Lorengau 15 1.5 22.5
24 February 1993 1993 Michael Ndrih Lorengau 1 2 2
24 February 1993 1993 Michael Ndrih Lorengau 19 3 57
24 February 1993 1993 Michael Ndrih Lorengau 6 0.2 1.2
24 February 1993 1993 Michael Ndrih Lorengau 4 2 8
24 February 1993 1993 Michael Ndrih Lorengau 5 1.5 7.5
24 February 1993 1993 Michael Ndrih Lorengau 8 0.2 1.6
26 August 1993 1993 N'DRINEI HAPKAS Lorengau 9 1.5 13.5
26 August 1993 1993 N'DRINEI HAPKAS Lorengau 10 2.5 25
26 August 1993 1993 N'DRINEI HAPKAS Lorengau 3 0.2 0.6
26 August 1993 1993 N'DRINEI HAPKAS Lorengau 12 0.2 2.4
24 February 1993 1993 Paul Muguas Lorengau 12 3 36
24 February 1993 1993 Paul Muguas Lorengau 7 1.5 10.5
24 February 1993 1993 Paul Muguas Lorengau 7 0.2 1.4

What I want to end up with, is a workfile that aggregates each collector by month (not day) and sums the Q and TR values. The dates are irregular. And the number of records for each collector also varies.

I hope this makes sense and the process is not too complex.

TIA

B

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

Re: Stacking raw data - help

Postby EViews Gareth » Thu Apr 28, 2016 1:28 am

Should be pretty straight forward, but we'd need the actual file.

Chthoniid
Posts: 24
Joined: Mon Oct 22, 2012 6:02 pm

Re: Stacking raw data - help

Postby Chthoniid » Thu Apr 28, 2016 2:08 pm

Thanks- I suspect there's something very simple I've overlooked.

File attached
Attachments
PRIAMUS_V2.xlsx
(228.35 KiB) Downloaded 364 times

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

Re: Stacking raw data - help

Postby EViews Gareth » Thu Apr 28, 2016 11:57 pm

Code: Select all

wfopen priamus_v2.xlsx svector collectornames = @uniquevals(collector) !numcols = @rows(collectornames) %firstmonth = @datestr(@min(date), "YYYY/MM/DD") %lastmonth = @datestr(@max(date), "YYYY/MM/DD") pagecreate(page=sum) m {%firstmonth} {%lastmonth} !numcols copy priamus_v2\collectornames sum\colnames alpha collector for !i=1 to !numcols smpl if @crossid=!i %name = colnames(!i) collector = %name next copy(c=s) priamus_v2\q sum\q @src date collector @dest @date collector copy(c=s) priamus_v2\tr sum\tr @src date collector @dest @date collector pagestruct @date(dateid) collector pagecontract if q<>na or tr<>na show q tr


Return to “Data Manipulation”

Who is online

Users browsing this forum: Dag Kolsrud and 2 guests