using/accessing different work sheets through program

For questions regarding programming in the EViews programming language.

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

macroecon_guy
Posts: 1
Joined: Wed Aug 04, 2010 5:37 am

using/accessing different work sheets through program

Postby macroecon_guy » Wed Aug 04, 2010 6:48 am

Hi there,

I would like to create a program that runs the same operations on different worksheets in a workfile, but I have not been able to figure out how it works.

The steps I would like to follow were the following:

1. I have used the code provided to load multiple sheets from excel into eviews and now have an eviews workfile called "data" with multiple sheets. Assume for simplicity that there are only two sheets, named "ea" and "po". Each sheet for simplicity only includes two data series each called "X" and "Y" in each sheet.

2. The main program loads "data" and is supposed to

i) regress "Y" on "X" in each sheet
ii) store the output

I have not been able to do either 2 i) or ii) in any user friendly way (i.e. the file automatically running over all sheets, having a loop, etc). Put differently, I do not know how to access different work sheets in a work file, nor how to save the resulting workfiles.

Many thanks for your help.

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

Re: using/accessing different work sheets through program

Postby EViews Gareth » Wed Aug 04, 2010 8:08 am

You can use the PAGESELECT command to switch/select different pages. You can use the WFSAVE command to then save the workfile.

recosveco7
Posts: 3
Joined: Sun Jan 15, 2012 9:57 am

Re: using/accessing different work sheets through program

Postby recosveco7 » Sun Jan 15, 2012 10:01 am

Hi Gareth,
I would like to ask you to further clarify how to use pageselect.
I want to run the same program on a workfile with multiple pages.
If I use pageselect more than once (to run the program on each page) I get an error messare saying that a page has already been selected and the program cannot move and run on another page.
Can you please help? I have been also looking into looping pages of a workfile but have not been able to find any help.
Thanks a lot for your help!

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

Re: using/accessing different work sheets through program

Postby EViews Gareth » Sun Jan 15, 2012 11:32 am

Hard to help without knowing what you've done.

recosveco7
Posts: 3
Joined: Sun Jan 15, 2012 9:57 am

Re: using/accessing different work sheets through program

Postby recosveco7 » Mon Jan 16, 2012 1:30 am

I have created a program that downloads 20+ excel worksheets into different pages of an eviews work file. These sheets are organized identically.
All i need to do is to run the same program onto each page of the work file, one after the other and extract the results - maybe by exporting them into excel again.
For now I have tried using "pageselect" with "include" but the error I get suggests I cannot "include" my program more than once.
I imagine I should be looping through each page but have not figured out the right way to do so.
Thanks!

recosveco7
Posts: 3
Joined: Sun Jan 15, 2012 9:57 am

Re: using/accessing different work sheets through program

Postby recosveco7 » Mon Jan 16, 2012 3:05 am

I found a solution:

for %s page1 page2 page3
pageselect {%s}
include "program.prg"
next

thanks anyways!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests