Hi, Paul
Thank you for your help. But I met another problem when I input io.xls to cge1.gms
The code and error are shown as followed:
Parameter io(sec,sec2) io table;
$call “gdxxrw io.xls output=io.gdx par=io rng=a1:f7 cdim=1 rdim=1” ;
$gdxin io.gdx
$loaddc io
$gdxin
***Input file not found =C:\Users\fuxue\Documents\gamsdir\projdir\io.xls
Total time =437 Ms
—CGE0.GMS(21) 3 Mb
*** GDXIN failed C:\Users\fuxue\Documents\gamsdir\projdir\io.gdx
***Msg: No such file or directory
—CGE0.GMS(21) 3 Mb 2 Errors
***Error 510 in C:\Users\fuxue\Documents\gamsdir\projdir\CGE0.GMS
Unable to open gdx file for $GDXIN
—CGE0.GMS(22) 3 Mb 2 Errors
***Error 502 in C:\Users\fuxue\Documents\gamsdir\projdir\CGE0.GMS
GDXIN file not open - ignore rest of line
—CGE0.GMS(45) 3 Mb 3 Errors
***Error 141 in C:\Users\fuxue\Documents\gamsdir\projdir\CGE0.GMS
Symbol neither initialized nor assgned
Kind regards
Xue
在 2013å¹´9月25日星期三UTC-4下åˆ3æ—¶13分52秒,Paul Van der Eijk写é“:
Execute ‘happens’ at execution time; the $GDXIN and $LOAD at compile time. So you will create your sam.gdx file too late. Using $call GDXXRW should help you.
–Paul
On Wed, Sep 25, 2013 at 1:57 PM, wrote:
Hi, Pedro
I am try to input the SAM data from the xls to Gams. I use the following code.
execute “gdxxrw sam.xls output=sam.gdx par=sam rng=a1:f6 cdim=1 rdim=1” ;
Parameter SAM (u,v) social accounting matrix;
$gdxin sam.gdx
$loaddc sam
$gdxin
But it is error like:
*** GDXIN failed C:\users\fuxue\Documents\gamsdir\projdir\sam.gdx
***Msg:No such file or directory
— splcge.gms(14) 3 Mb 1 Error
*** Error 510 in C:\Users\fuxue\Documents\gamsdir\projdir\splcge.gms
Unable to open gdx file for $ GDXIN
— splcge.gms(14) 3 Mb 2 Error
*** Error 502 in C:\Users\fuxue\Documents\gamsdir\projdir\splcge.gms
GDXIN file not open - ignore rest of line
*** Error 141 in C:\Users\fuxue\Documents\gamsdir\projdir\splcge.gms
Symbol neither initialized nor assigned
Thanks!
Xue
在 2012å¹´6月22日星期五UTC-4上åˆ5æ—¶01分55秒,PowerChile写é“:
Hi Fede,
Maybe this can work:
SET i /1*3/;
PARAMETER a(i);
$call GDXXRW I=data.xls O=data.gdx par=a rng=data!A1:B3
$GDXIN data.gdx
$LOAD a
$GDXIN
Cheers,
Pedro
On Fri, Jun 22, 2012 at 8:30 AM, Federico Perea wrote:
Hey gams community!
I have trouble importing data from Excel to GAMS. The following code
does not seem to work
set i passes /1*3/;
Parameter a(i);
$CALL GDXXRW.EXE data.xls par=a rng=data!A1:B3
$GDXIN data.gdx
$LOAD a
$GDXIN
Any ideas on how to solve this? I attach a zip file in case you want
to try it on your own.
Thanks a lot for your help!
Fede
–
CGE0.GMS (3.92 KB)
io.xlsx (7.83 KB)