Merging cross sectional data

For questions regarding programming in the EViews programming language.

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

jaghetermattis
Posts: 7
Joined: Tue Apr 21, 2015 5:48 am

Merging cross sectional data

Postby jaghetermattis » Mon May 04, 2015 6:24 am

I would be most grateful for some help on merging cross sectional data.
I want to merge 4 data sets for the years 2011-2014, for a pooled regression. The datasets are each in a respective page in a wf. The problem is that if I use the copy command to merge the four years the observations gets replaced, as oppose to the "lenghtening" of the series that I want. The variables/objects have the same names each year, and are identified by and id variable (simple, running from 1 - to whatever lenght of the series). So far:

%wf = "path\wfallblu.wf1"
%wf2011= %wf + "\2011"
%wf2012= %wf + "\2012"
%wf2013= %wf + "\2013"
%wf2014= %wf + "\2014"

wfcreate(wf=reg, page=pool) u 84072 '(the total number of observations i each serie if all year where to be added)

wfopen %wf
for !j=1 to 4
pageselect 201{!j}
copy(c=l) * reg::pool\*
next

Anyone have a solution to this? One thing I thought of is creating new id series running from 1 to 84072, but I'm not sure how to create a series like this. A solution to that would be highly appreciated as well.

Best,
Matt

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

Re: Merging cross sectional data

Postby EViews Gareth » Mon May 04, 2015 8:21 am

Use the pageappend command.

jaghetermattis
Posts: 7
Joined: Tue Apr 21, 2015 5:48 am

Re: Merging cross sectional data

Postby jaghetermattis » Tue May 05, 2015 2:59 am

Great, that's exactly what I wanted to do. As always, you're a lifesaver Gareth - thank you!
I did however only get it to work by going through the menu. When using the code:

%wf = "path\Workfiles\wfallblu.wf1"
%wf2011= %wf + "\2011"
%wf2012= %wf + "\2012"
%wf2013= %wf + "\2013"
%wf2014= %wf + "\2014"

wfcreate(wf=reg, page=pool) u 11476
wfsave "path\Workfiles\reg.wf1"
wfopen %wf
pageselect 2011
'copy * reg::pool\*
'pageselect 2012
wfselect reg

pageappend %wf2012

I get the error msg "path@ALL was not found in "pageappend "path\Workfiles\wfallblu.wf1". I've tried several different options of the pageappend command, none work, but default settings through the menu works (indicating that there's no problem with the paths).

Would highly appreciate some guidance!

jaghetermattis
Posts: 7
Joined: Tue Apr 21, 2015 5:48 am

Re: Merging cross sectional data

Postby jaghetermattis » Tue May 05, 2015 3:12 am

Nevermind - I used "pageappend wfallblu\2012" and it worked!

Not sure why
%wf = "path\wfallblu.wf1"
%wf2012= %wf + "\2012"
pageappend %wf2012
does not work, but it doesn't really matter.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests