Hi,
How can I write my GAMS result using a mac?
For the import of the data, I create GDX files with Windows but for saving the results I don't know how to do it.
The command
execute 'gdxxrw.exe result.gdx o=result.xlsx par=result'
doesn't work.
Thank you in advance
Saving result on MAC
Re: Saving result on MAC
Just do this opposite. Bring the result.gdx over to your Windows machine and run gdxxrw to create results.xlsx from your results.gdx.
-Michael
-Michael
-
- User
- Posts: 13
- Joined: 2 years ago
Re: Saving result on MAC
Many thanks Bussieck to reply,
there is an alternative for working only with mac?
I saw that it is possible to work with CSV but I did not find any example for exporting results
there is an alternative for working only with mac?
I saw that it is possible to work with CSV but I did not find any example for exporting results
Re: Saving result on MAC
The put file facility (https://www.gams.com/latest/docs/UG_Put.html) gives you access to creating your own ASCII files, including CSV file. You can also use gdxdump (https://www.gams.com/latest/docs/T_GDXD ... ING_TO_CSV). If you search the GAMS documentation (yes, there is a search!) for CSV you will get many good hits, like https://www.gams.com/38/docs/UG_DataExchange_ASCII.html.
-Michael
-Michael
-
- User
- Posts: 13
- Joined: 2 years ago
Re: Saving result on MAC
Hi Michael
I am still having problems with csv, please bear with me...
I followed a lot of examples but I can’t import a multidimension parameter (3 dim) defined in the following CSV The code is the following
Table fuel_price(year,fuel,scen);
$call csv2gdx "/Users/martinagherardi/Desktop/Visiting/2022-04-12 comparison/FUEL_PRICE-Stoc 2.csv" output="/Users/martinagherardi/Desktop/Visiting/2022-04-12 comparison/FUEL_PRICE-Stoc 2.gdx" id=fuel_price index=1,2 values=2..lastCol useHeader=y valueDim=y
$GDXIN FUEL_PRICE-Stoc 2.gdx
$onUNDF
$LOAD fuel_price
$GDXIN
The GDX file is created but the dimensions are wrong ….
Could you help me please ?
I am still having problems with csv, please bear with me...
I followed a lot of examples but I can’t import a multidimension parameter (3 dim) defined in the following CSV The code is the following
Table fuel_price(year,fuel,scen);
$call csv2gdx "/Users/martinagherardi/Desktop/Visiting/2022-04-12 comparison/FUEL_PRICE-Stoc 2.csv" output="/Users/martinagherardi/Desktop/Visiting/2022-04-12 comparison/FUEL_PRICE-Stoc 2.gdx" id=fuel_price index=1,2 values=2..lastCol useHeader=y valueDim=y
$GDXIN FUEL_PRICE-Stoc 2.gdx
$onUNDF
$LOAD fuel_price
$GDXIN
The GDX file is created but the dimensions are wrong ….
Could you help me please ?
Re: Saving result on MAC
CSV files usually have a single header file (at least csv2gdx only understands those CSV files). You need to reshuffle your file like this:
The following csv2gdx call "csv2gdx x.csv output=x.gdx id=fuel_price index=1..2 values=3..lastCol useHeader=y valueDim=y" should work properly. You need to declare your parameter fuel_price with a different domain set order: fuel_price(fuel,scen,year).
-Michael
Code: Select all
fuel,scen,2017
Gas1,Scen1,9.79
Gas1,Scen2,9.79
Gas1,Scen3,9.89
...
-Michael
-
- User
- Posts: 13
- Joined: 2 years ago
Re: Saving result on MAC
Hi Michael,
many thanks for the reply.
I saw that in the reshuffle you didn't write year. How can I deal with values for multiple years? so for example if the set of years contains 2017 and 2018
many thanks for the reply.
I saw that in the reshuffle you didn't write year. How can I deal with values for multiple years? so for example if the set of years contains 2017 and 2018
Re: Saving result on MAC
Just add them as columns:
-Michael
Code: Select all
fuel,scen,2017,2018
Gas1,Scen1,9.79,10.01
Gas1,Scen2,9.79,10.02
Gas1,Scen3,9.89,10.03
...