Variable sequence as a set

Hi
I need to implement the following
Once I load a scalar value (say value for x) from an excel file, I need to use this value to create a sequence set as follows

Set i sequence given by the user /1*x/

This gives me an error, so how can I create a variable set, where the user will provide the length of this set.

Thank you

Hi

You could define an overall set with the maximum of x as the number of elements:

set k /1*10000/;

Then you define a dynamic subset and use the value from excel to define it:

set  i(k);
i(k)$(val.k < x+1) = YES;

Renger

Dear Renger

Thank you for help. This solution doesn’t work with gams 24.5.3. It gives me error 140: unknown symbol and points to val.k; however, when I have tried
k.val instead of val.k, it worked. Thank you.

Regards
Wael