Discussion:
[Gretl-users] Export output to excel or csv
valentina colombo
2014-04-10 14:14:25 UTC
Permalink
Dera gretl users,
I had estimate my SVAR model and I need to export the estimated coefficients (bootdata) to excel or csv file. I have tried to use the following command but it is storing my variables but not bootdata (from a SVAR).
store /home/valentina/bootdata.csv bootdata
! gnumeric /home/valentina/bootdata.csvAny suggestion? I cannot go on with my estimation!!
Thanks
Valentina

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wfu.edu/pipermail/gretl-users/attachments/20140410/51cdbc68/attachment.html
Sven Schreiber
2014-04-11 07:55:39 UTC
Permalink
Post by valentina colombo
Dera gretl users,
I had estimate my SVAR model and I need to export the estimated
coefficients (bootdata) to excel or csv file. I have tried to use the
following command but it is storing my variables but not bootdata (from
a SVAR).
store /home/valentina/bootdata.csv bootdata
! gnumeric /home/valentina/bootdata.csv
By design, 'store' only saves data (=series), as explained in the docs.
If 'bootdata' is not the name of a series and gretl does not complain
here, this could actually be a (small) bug.

To save matrices, you can use the 'mwrite()' function. To save arbitrary
stuff to a text file, use the 'outfile' command to specify the target
file (with option '--quiet'), and then use your own 'print' or 'printf'
commands. Don't forget 'outfile --close' at the end.

hth,
sven
Ignacio Diaz-Emparanza
2014-04-11 07:56:17 UTC
Permalink
Post by valentina colombo
Dera gretl users,
I had estimate my SVAR model and I need to export the estimated
coefficients (bootdata) to excel or csv file. I have tried to use the
following command but it is storing my variables but not bootdata
(from a SVAR).
store /home/valentina/bootdata.csv bootdata
! gnumeric /home/valentina/bootdata.csv
Any suggestion? I cannot go on with my estimation!!
Thanks
Valentina
For this type of things I use a combination of 'outfile' and 'printf'
commands. An example is below. The lines from 'open' to 'var' command
are taken from gretl example sw_ch14.in. The result is the file
"coefficients.csv" in your current gretl working directory.

<hansl>
open sw_ch14.gdt

# set the robust std errors variant used by S and W
set force_hc on
set hc_version 1

genr infl = 400 * log(PUNEW/PUNEW(-1))
diff infl
lags d_infl LHUR
smpl 1962:1 1999:4

# run "automatic" VAR, (see equations 14.5 and 14.6) in Stock and Watson,
# "Introduction to Econometrics", chapter 14
var 4 d_infl LHUR const -r

##########
set messages off
set echo off
matrix B=$coeff
scalar ncoefs=rows(B)
outfile coefficients.csv --write
loop i=1..ncoefs --quiet
printf "%.4f, %.4f\n ", B[i,1], B[i,2]
endloop
outfile --close
</hansl>
--
Firma Arista
*Ignacio D?az-Emparanza*
Zuzendaria/Director
ignacio.diaz-emparanza at ehu.es <mailto:ignacio.diaz.emparanza at ehu.es>
94 6013732
*EKONOMIA APLIKATUA III SAILA (EKONOMETRIA ETA ESTATISTIKA)/
DEPARTAMENTO DE ECONOM?A APLICADA III (ECONOMETR?A Y ESTAD?STICA)
UPV/EHU*
Avda. Lehendakari Aguirre, 83 | 48015 BILBAO
*T.: +34 946013740* | *F.: +34 946013754*
*www.ea3.ehu.es* <http://www.ea3.ehu.es>

ERNE! Baliteke mezu honen zatiren bat edo mezu osoa legez babestuta
egotea. Mezuak badu bere hartzailea. Okerreko helbidera heldu bada
(helbidea gaizki idatzi, transmisioak huts egin) eman abisu igorleari,
korreo honi erantzunda. Kontuz! Mezua ez bada zuretzat, ez erabili, ez
zabaldu beste inori, ez kopiatu eta ez baliatu.
?ATENCI?N! Este mensaje contiene informaci?n privilegiada o confidencial
a la que s?lo tiene derecho a acceder el destinatario. Si usted lo
recibe por error le agradecer?amos que no hiciera uso de la informaci?n
y que se pusiese en contacto con el remitente.

E-mail hau inprimatu baino lehen egiaztatu inprimatzeko beharra.
Antes de imprimir este e-mail piense bien si es necesario hacerlo.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wfu.edu/pipermail/gretl-users/attachments/20140411/658ef23e/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: firma_email_upv_euskampus_bilingue.gif
Type: image/gif
Size: 4236 bytes
Desc: not available
Url : Loading Image...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: recicla_firma_email_upv.gif
Type: image/gif
Size: 225 bytes
Desc: not available
Url : Loading Image...
Ignacio Diaz-Emparanza
2014-04-11 08:07:11 UTC
Permalink
Post by Ignacio Diaz-Emparanza
..
##########
set messages off
set echo off
matrix B=$coeff
scalar ncoefs=rows(B)
outfile coefficients.csv --write
loop i=1..ncoefs --quiet
printf "%.4f, %.4f\n ", B[i,1], B[i,2]
endloop
outfile --close
</hansl>
Sorry, the space after \n should not be there.
--
Firma Arista
*Ignacio D?az-Emparanza*
Zuzendaria/Director
ignacio.diaz-emparanza at ehu.es <mailto:ignacio.diaz.emparanza at ehu.es>
94 6013732
*EKONOMIA APLIKATUA III SAILA (EKONOMETRIA ETA ESTATISTIKA)/
DEPARTAMENTO DE ECONOM?A APLICADA III (ECONOMETR?A Y ESTAD?STICA)
UPV/EHU*
Avda. Lehendakari Aguirre, 83 | 48015 BILBAO
*T.: +34 946013740* | *F.: +34 946013754*
*www.ea3.ehu.es* <http://www.ea3.ehu.es>

ERNE! Baliteke mezu honen zatiren bat edo mezu osoa legez babestuta
egotea. Mezuak badu bere hartzailea. Okerreko helbidera heldu bada
(helbidea gaizki idatzi, transmisioak huts egin) eman abisu igorleari,
korreo honi erantzunda. Kontuz! Mezua ez bada zuretzat, ez erabili, ez
zabaldu beste inori, ez kopiatu eta ez baliatu.
?ATENCI?N! Este mensaje contiene informaci?n privilegiada o confidencial
a la que s?lo tiene derecho a acceder el destinatario. Si usted lo
recibe por error le agradecer?amos que no hiciera uso de la informaci?n
y que se pusiese en contacto con el remitente.

E-mail hau inprimatu baino lehen egiaztatu inprimatzeko beharra.
Antes de imprimir este e-mail piense bien si es necesario hacerlo.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wfu.edu/pipermail/gretl-users/attachments/20140411/7d7194ce/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: firma_email_upv_euskampus_bilingue.gif
Type: image/gif
Size: 4236 bytes
Desc: not available
Url : Loading Image...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: recicla_firma_email_upv.gif
Type: image/gif
Size: 225 bytes
Desc: not available
Url : Loading Image...
Riccardo (Jack) Lucchetti
2014-04-11 08:15:40 UTC
Permalink
Post by Ignacio Diaz-Emparanza
Post by valentina colombo
Dera gretl users,
I had estimate my SVAR model and I need to export the estimated
coefficients (bootdata) to excel or csv file. I have tried to use the
following command but it is storing my variables but not bootdata (from a
SVAR).
store /home/valentina/bootdata.csv bootdata
! gnumeric /home/valentina/bootdata.csv
Any suggestion? I cannot go on with my estimation!!
Thanks
Valentina
For this type of things I use a combination of 'outfile' and 'printf'
commands. An example is below. The lines from 'open' to 'var' command are
taken from gretl example sw_ch14.in. The result is the file
"coefficients.csv" in your current gretl working directory.
<hansl>
open sw_ch14.gdt
# set the robust std errors variant used by S and W
set force_hc on
set hc_version 1
genr infl = 400 * log(PUNEW/PUNEW(-1))
diff infl
lags d_infl LHUR
smpl 1962:1 1999:4
# run "automatic" VAR, (see equations 14.5 and 14.6) in Stock and Watson,
# "Introduction to Econometrics", chapter 14
var 4 d_infl LHUR const -r
##########
set messages off
set echo off
matrix B=$coeff
scalar ncoefs=rows(B)
outfile coefficients.csv --write
loop i=1..ncoefs --quiet
printf "%.4f, %.4f\n ", B[i,1], B[i,2]
endloop
outfile --close
</hansl>
Also: don't be fooled by file extensions. If you use the "mwrite" command,
like Sven suggested, you'll obtain a text file that you can conveniently
open either in your favourite text editor or in any spreadheet worth
considering.


-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)

Universit? Politecnica delle Marche
(formerly known as Universit? di Ancona)

r.lucchetti at univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------

Loading...