I have a problem with writing a GAMS syntax which should be applied on
100 datasets (IN AN EXCEL
FORMAT).The problem is that, in my research, after simulating the
data
using GAMS and saving the output in 100 excel files, i imported the
100 datasets to the
SPSS,performed some operations and then i saved the data in the excel
format. Now i
need to import these new resulting 100 datasets to GAMS using $call.
And apply my
GAMS model to them. And then save the output to 100 excel files.
My program looks something likethat if written for a single dataset:
1-Parameter and sets definitions based on calling certain data:
Sets
S1 /
$call =xls2gms "i=E:\simuldata1\datag1.xls" o=E:\work\dataif1.inc
R=datag1!a2:a12
$include E:\work\dataif1.inc/;
Parameters
(S1) p /
$call =xls2gms "i=E:\simuldata1\datag1.xls" o=E:\work\data21.inc
R=datag1!j2:k12
$include E:\work\data2l.inc/;
2-Other variables (which should result as an output of solving a
certain model) and equations:
Variables
V1(i)
Equations
F1 .. =E=SUM(S1,p(S1) );
constr1(S1) .. P=E=SUM(i,,x(S1,i));
z1 ..
Model1 /F1,constr1/;
Solve Model1 using nlp minimizing z1;
****3-Writting the output to excel file
Execute_Unload "data2.gdx" V1
Execute 'GDXXRW.EXE data2.gdx sq=0 o=E:\simuldata\data1.xls var= V1
rng=sheet2!e2 rdim=1';
And this syntax should be applied to the 100 excel datasets
(datag1……….datag100) and saved on 100 excel files (data1…………………
data100).I should also have 100 sets S1……………..S100 each set based on
calling one data of the 100 and the same thing applies to all
parameters ,variables and equations.
How could I put this syntax in a loop to produce the required output?
Thanks in advance