Problem with data

Problems with modeling
Post Reply
RZoro95
User
User
Posts: 2
Joined: 2 weeks ago

Problem with data

Post by RZoro95 » 2 weeks ago

Hi everyone, my name is Matteo. I have a problem or rather I don't know how to proceed with a problem in gams. In practice I have "s" sectors and "i" assets, I have to take the data of a score from an excel sheet where on each sheet there is the score for each i, so they are one-dimensional, while the sectors would be the various sheets. Is there any way to do this?

This is the code i use, but is not good:

SET
k criteri /pe,pbv,roe,roa,roi,il,de/;

SET

s settori /1*8/;

*$onMulti
SET i stocks /1*5/;

Parameter KScor(s,i);
$call "gdxxrw KScore.xls par=KScor";
$gdxin KScore.gdx
$load KScor
display KScor;


i attached the image of the excel data.
wew23.PNG

GFA
User
User
Posts: 39
Joined: 3 years ago

Re: Problem with data

Post by GFA » 1 week ago

Hi Rzoro95,

Two options I can think of:
1) make a new sheet and add the data of all the sheets into one two-dimensional table. Then you only need to read-in one table.
2) read in data per sheet into seperate parameters (e.g. parameters foglio1(i) ... foglio8(i)) and add them together in GAMS in a two-dimensional parameter (eg. Total(i,"1")=foglio1(i).. etc.)

Make sure to use relevant parameters in your GDXXRW call (see also: https://www.gams.com/35/docs/T_GDXXRW.html)

Ragards,
GFA

Post Reply