Read part of a table

Hello,

I’m Beginning with GAMS. I would like to know if it’s possible to do loop with “sub-set”? For example considering a table with the months of the year /M1M120/, is it possible to create sub-set as /M1M12/, /M13M24/, /M25M36/ etc… and do a loop on a statement in order to have the results for each year?
Or do I have to do several tables?

Thank you for your help,

Stan

Hi Stan

You can build subsets like this

set
	year '		'Full set of years' /M1*M120/;
	year1(year) 	'First half of all years' /M1*M12/,
	year2(year)	'Second half of all years' /M25*M36/;
loop(year1, 
....
);

or loop over all years but constrain the loop to the first half

loop(year$year1(year),
..
);

If you have a table over all years, eg.

info(year, techn)  Table with info on each technology for each year;

You could for example values to a parameter with only values of the first half of years:

parameter firstech(year1, techn);
firsttech(year1, techn) = info(year1, techn);

Hope this helps
Cheers
Renger