Data Transfer with Same Index Length

Problems with syntax of GAMS
Post Reply
GabrielYin
User
User
Posts: 72
Joined: 6 years ago
Location: Dallas, TX, USA
Contact:

Data Transfer with Same Index Length

Post by GabrielYin »

Hi all,

I got stuck in how to transfer the table/parameter data with different index but the same length. Take the following as an example:

Code: Select all

Set
         l       All Trans. Lines/l1*l81/
         cl(l)   Candidate Trans. Lines   /l7*l81/
         cl1(cl)   Candidate Trans. Lines  /l7*l21/
         cl2(cl)  /l22*l36/         ;
         
Table    CLDATA1(cl1, *)   Trans. Lines Data
         X       FLmax   IC
l7       0.40    100     7723.2
l8       0.38    100     7337.04
l9       0.60    80      11584.8
l10      0.20    100     3861.6
l11      0.68    70      13129.44
l12      0.20    100     3861.6
l13      0.40    100     7723.2
l14      0.31    100     5985.48
l15      0.30    100     5792.4
l16      0.59    82      11391.72
l17      0.20    100     3861.6
l18      0.48    100     9267.84
l19      0.63    75      12164.04
l20      0.30    200     5792.4
l21      0.61    78      11777.88
;

Table    CLDATA2(cl2, *)   Trans. Lines Data;
I want to copy the data of Table CLDATA1 to Table CLDATA2 but 'IC' value should be 2 times higher in CLDATA2. I know it is easy and brainless to just write them explicitly when the data length is short, but it would be a disaster when one needs to copy 10,000 lines of data but with the same length of index. Does GAMS has any efficient way to do this?

Best,
Gabriel
Post Reply