Hello,

I want to assign the row value of 2D parameter to 1D parameter as follows:

```
set
i /i1*i4/ , j /j1,j2/;
Parameter A(i);
Table Rf(j,i)
i1 i2 i3 i4
j1 1 2 3 4
j2 8 7 9 8;
```

Here, I can do as follows:

```
A(i) = Rf('j1' , i);
```

However. I will not be knowing j1 or j2 apriori. Instead, I will be only knowing ord(j).

For instance, I will have to assign Rf(‘j1’ , i) to A(i) if ord(j) = 1.

I can also use if else loop, but can any one tell me, if I can directly use ord(j) to assign appropriate Rf(j,i) to A(i) ?

Thanks

```
A(i) = sum(j$(ord(j)=1),Rf(j, i);
```

-Michael

Thanks a lot. It really saved my time. Can you please suggest me, where can I get such examples where I can learn similar to what you have said ? I am familiar to MATLAB, therefore, I am not able to do / think directly as you !

Read the chapters on sets, dynamic set, and conditional expressions and assignment in the GAMS Users Guide. Relational algebra (also used in SQL) with sets is an extremely powerful way to express data transformations and is usually much faster than normal programming loops and conditional (ifthen/else) logic. It takes some time to learn and get used to this. It is worthwhile.

-Michael