I have to use one parameter to store the following information: n variables, each variable can take Sn values. I have a toy example, 3 variables and each of them can take 1 or 2. The desired outcome should be like this:

Note that here I used three indices s1 s2 s3 to express. Then I wonder if there is a way to only use one index, say s /1*8/, to achieve this. Then the desired outcome would be like the following (here I express it like a table for convenience, but I actually want a parameter)

It is a toy example though but I can use the idea to express more complicated instance like 21 variables and each of them can have 10 or more possible values. Anyone can give a comment on this is highly appreciated!

$set digits 3
set s / s1*s%digits% /, b / 1,2,3 /;
$eval nMax power(card(b),card(s))
set n / n1*n%nMax% /
x(n,s,b) / system.powerSetRight /;
parameter xp(n,s); loop(x(n,s,b), xp(n,s) = b.val;)
option xp:0:1:1; display xp;

Be aware of the data you generate! 21 “variables” with 10 different values gives you 10^21 elements. I hope you know how large this number is. No way to store these explicitly on a computer.

Thank you Michael! I know the scenario number is very large if I want to do that way. I had the honor to read one of your paper about GUSS: https://www.gams.com/modlib/adddocs/gusspaper.pdf
At the bottom of the paper, you illustrated the performance of GUSS with an SDDP problem, which solved 60,000+ LP problems. I have checked the codes you shared in the GAMS library about that part. However, water.gdx seemed not readable in my computer. So, I am wondering how you store your scenarios in that problem. I guess the way you did was totally different with mine in this post.

I have another idea about how to store the scenarios. That is firstly to find out all discrete distribution of each random parameter then pick them up one by one in the loop. The sample code is shown below.

Set ff /ff1*ff50/
tmp1 /1*2/;
option decimals=6;
$set inputdir "C:\Users\Gabriel\Desktop"
Table c15RHS(ff, tmp1) RHS Data
$include "%inputdir%\C15RHS.txt";
Table c16RHS(ff, tmp1) RHS Data
$include "%inputdir%\C16RHS.txt";
Table c17RHS(ff, tmp1) RHS Data
$include "%inputdir%\C17RHS.txt";
Table c18RHS(ff, tmp1) RHS Data
$include "%inputdir%\C18RHS.txt";
Table c19RHS(ff, tmp1) RHS Data
$include "%inputdir%\C19RHS.txt";
Table c20RHS(ff, tmp1) RHS Data
$include "%inputdir%\C20RHS.txt";
Table c21RHS(ff, tmp1) RHS Data
$include "%inputdir%\C21RHS.txt";

Then we have 7 tables storing 50 discrete distributions of each random parameter, thus the total scenario number is 50^7.

I wonder if there is any other efficient way to store the scenarios in GAMS, then I can use GUSS to do stochastic programming thing.

Set dict / s1. scenario. ''
s2. scenario. ''
s3. scenario. ''
A1. param. A_s(s1)
A2. param. A_s(s2)
A3. param. A_s(s3)
x. lower. xlo_s(s1, s2, s3)
x. level. xl_s(s1, s2, s3)
e. marginal. em_s(s1, s2, s3) /;
solve mymodel min z using lp scenario dict;

That is the motivation of this post, I want to aggregate the parameter indices to one index then GUSS is applicable. I appreciate any suggestion or comment!