because the open function is not supported in loops I used the append
command
<hansl>
open ~/Desktop/simulation.xls --sheet=1 --rowoffset=2 --preserve
# grab the transpose of the data as a matrix
M = {dataset}'
# and record the length of the time dimension
scalar T = rows(M)
print M
#use a loop in order to parse all sheets in a spreadsheet
loop i=2..3
append ~/Desktop/simulation.xls --sheet=$i --rowoffset=2
# stick on row-wise the transpose of the next data
M |= {dataset}'
print M
endloop
scalar NT = rows(M)
# create a suitably sized dataset
nulldata NT --preserve
# pull out the columns of M as series
series v1 = M[,1]
series v2 = M[,2]
delete index
# hello gretl, this is a panel!
setobs T 1.1 --stacked-time-series
series year = time + 2004
# take a look
print --byobs
</hansl>
Thanks again for all the help :)
Mihai
On Fri, Sep 13, 2013 at 12:22 PM, cociuba mihai <cociuba(a)gmail.com> wrote:
Dear Allin,
because I have over 60 banks in different sheets I tried to construct a
loop with the open function (before I found that it can't be used in a loop
construction) nevertheless while tweaking this script gretl crashed several
times.
Maybe it's my poor scripting skill or perhaps a bug, anyway I thought you
should see it.
Attached script file and terminal output.
Mihai
On Thu, 12 Sep 2013, cociuba mihai wrote:
>* I have a spreadsheet file (simulation) which is attached , I'm trying to*>*
import it as panel data but if I try the built in import command from GUI I*>* only can
import the first sheet.*>* Can you give me any suggestion?*
Your data are sideways on, and need transposing. This is better done by
script.
<hansl>
open simulation.xls --sheet=1 --rowoffset=2 --preserve
# grab the transpose of the data as a matrix
M = {dataset}'
# and record the length of the time dimension
scalar T = rows(M)
open simulation.xls --sheet=2 --rowoffset=2 --preserve
# stick on row-wise the transpose of the next data
M |= {dataset}'
open simulation.xls --sheet=3 --rowoffset=2 --preserve
# stick on some more data
M |= {dataset}'
scalar NT = rows(M)
# create a suitably sized dataset
nulldata NT --preserve
# pull out the columns of M as series
series v1 = M[,1]
series v2 = M[,2]
delete index
# hello gretl, this is a panel!
setobs T 1.1 --stacked-time-series
series year = time + 2004
# take a look
print --byobs
</hansl>
Allin Cottrell