changing the amount of sets in parameter

Hi,

This may sound like a very simple question, maybe it has been asked before.

I want to know how you can remove superfluous sets in a parameter without changing any of the data in the parameter.

Firstly the sets and the parameter are defined as:

sets
AreaCode,centralamerica,ItemCode,crops,ElementCode,dollars,YearCode,Year,Unit

parameter
Prices_data(AreaCode,centralamerica,ItemCode,crops,ElementCode,dollars,YearCode,Year,Unit)

Some elements of the parameter, when displayed on a listing file, would look like this:

166.Panama    .56 .Maize     .5532.Producer Price (USD/tonne).1999.1999.USD 281
48 .Costa Rica.56 .Maize     .5532.Producer Price (USD/tonne).1999.1999.USD 217

I want the parameter to look like this:

parameter
Prices_data(centralamerica,crops,Year)

reducing the amount of sets, so that when displayed in a listing file it would be like this:

Panama.Maize.1999 281
Costa Rica.Maize.1999 217

Also I’d like to rename the set names, again, without changing the data, so that “centralamerica” has the name “region” and “year” has the name “period”, so that the parameter would look like this:

parameter
Prices_data(region,crops,time)

…is it also possible to change the order the sets with the parameter so it looks like this:

Prices_data(time,region,crops)

Thanks!

Hi
Yes, this is possible. The most secure way is just summing all the values so all the items are taken from the original tabel

Prices_data(centralamerica,crops,Year) = sum((AreaCode, ItemDoce, ElementCode, dollars, YearCode), Prices_data(AreaCode,centralamerica,ItemCode,crops,ElementCode,dollars,YearCode,Year,Unit));

The order of the sets in the new parameter is free, so you could have (centralamerica, year, crops) or (crops, year, centralamerica). However, note that when you change the order this might be a little bit slower (as far as I can remember).

If you want to keep the original sets as they are, you can just define an alias:
alias(year,time), (centralamerica, region).

I hope this helps

Renger

Hi there,

Thanks for the reply.

However, when I do this I get error messages:

Error 171 Domain violation for set
Error 148 Dimension different - The symbol is referenced with more/less indices as declared
Error 149 Uncontrolled set entered as constant

Hi
Please, show me your code that producers the error.
Cheers
Renger