## Data Exchange (Excel) to GAMS Topic is solved

Problems with syntax of GAMS
ikeato
User
Posts: 10
Joined: 10 months ago

### Data Exchange (Excel) to GAMS

Hi,

I have been working with GAMS (newbie) and having an issue with dealing with a lot of data which is more than the number required in excel (.xlsx), thus my data is more than 1million.

Please what is the best way to overcome this problem?

Secondly I have to import Set mc (shown below) data from Excel into GAMS to display like this in GAMS: /1.(1,2), 2.(1,36), 3.(1,1851), 4.(2,3), 5.(2,37), 6.(2,1852), 7.(2,1886)/

The Sets are:
i 'number of blocks' /1,2,36,1851,1885,3,37,1852,1886/
mcs 'number of mutually exclusive sets' /1*7/
mc(mcs,i)' description of mutually exclusive projects' /1.(1,2), 2.(1,36), 3.(1,1851), 4.(2,3), 5.(2,37), 6.(2,1852), 7.(2,1886)/

Please how do I arrange the data in excel to display like the above in blue in GAMS.

Kindly assist.

Thanks,
Isaac
Curtin University

Renger
Posts: 245
Joined: 2 years ago

### Re: Data Exchange (Excel) to GAMS

Hi
If you have more than one million datasets, you could save them in two or more separate tables. You then read those tables using gdxxrw.
After that, you can load the tables in one parameter using loaddcm.

Your mapping can be saved in an Excel table like this

Code: Select all

``````1   1
1   2
...
``````
You then can read the set mc like a normal set over the range of the two columns in excel with rdim=2.

Hope this helps
Cheers
Renger

ikeato
User
Posts: 10
Joined: 10 months ago

### Re: Data Exchange (Excel) to GAMS

Hi Renger,

Thanks for the assistance.

Please I tried it but it gives an error that the dimension of a domain should be 1 for mc.

I have attached the excel and GAMS for your review.

Regards,

Isaac
Attachments
Untitled_UPLexcelimporttrials.gms
(508 Bytes) Downloaded 15 times
TestUPL.xls
(30.5 KiB) Downloaded 20 times

ikeato
User
Posts: 10
Joined: 10 months ago

### Re: Data Exchange (Excel) to GAMS

Hi Renger,

I have been able to sort it out.

It's because I was calling the set from excel into GAMS using "dset" instead of "set".

It worked when I changed it.

Regards,
Isaac