Page 1 of 1

Merging cross sectional data

Posted: Mon May 04, 2015 6:24 am
by jaghetermattis
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

Re: Merging cross sectional data

Posted: Mon May 04, 2015 8:21 am
by EViews Gareth
Use the pageappend command.

Re: Merging cross sectional data

Posted: Tue May 05, 2015 2:59 am
by jaghetermattis
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!

Re: Merging cross sectional data

Posted: Tue May 05, 2015 3:12 am
by jaghetermattis
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.