Hi,

I use GDX to load data to parameters. Some parameters display zero values, such as VINTCD0 (intermediate inputs). The FRICTION.gdx file shows all correct values for VINTCD0. Is there any problme with data loading? Why no value is loaded to these parameters?

$call gdxxrw FRICTION.xlsx @FRICTION.txt

$gdxin FRICTION.gdx

$load VD0 VINTCD0 VFACD0 VF0 VINTCF0 VFACF0 TAXM0 VT0 TN VQH0 QG QINV FSAVD0 FSAVF0 FSAVK0 SIGMA GAMMA SIGMAP ITA

Thank you very much!

Qiaomin

## Load zero values to GAMS from GDX File

### Re: Load zero values to GAMS from GDX File

Hi Qiaomin

Please submit your code and other necessary files as your question contains not enough information to answer it.

Cheers

Renger

Please submit your code and other necessary files as your question contains not enough information to answer it.

Cheers

Renger

____________________________________

Enjoy modeling even more: Read my blog on modeling at The lazy economist

Enjoy modeling even more: Read my blog on modeling at The lazy economist

### Re: Load zero values to GAMS from GDX File

Hi Qiaomin

Please submit your code and other necessary files as your question contains not enough information to answer it.

Cheers

Renger

[/quote]

Please submit your code and other necessary files as your question contains not enough information to answer it.

Cheers

Renger

[/quote]

Last edited by qli091 1 year ago, edited 3 times in total.

### Re: Load zero values to GAMS from GDX File

Hi

A zero value is loaded but GAMS assumes zero for a parameter without a value, so it is only a problem in displaying the values.

If you want to display zero values in your listing, you can add EPS to all values of a parameter. The display will then show EPS for the zero values (the special value EPS is numerically equal to zero, so when used in the context of numerical comparisons, it behaves as zero).

e.g.
Cheers

Renger

A zero value is loaded but GAMS assumes zero for a parameter without a value, so it is only a problem in displaying the values.

If you want to display zero values in your listing, you can add EPS to all values of a parameter. The display will then show EPS for the zero values (the special value EPS is numerically equal to zero, so when used in the context of numerical comparisons, it behaves as zero).

e.g.

Code: Select all

`a(i,j) = a(i,j) + EPS;`

Renger

____________________________________

Enjoy modeling even more: Read my blog on modeling at The lazy economist

Enjoy modeling even more: Read my blog on modeling at The lazy economist

### Re: Load zero values to GAMS from GDX File

Thanks Renger,

But displaying zero values is wrong. The parameters are non-zero. As you can see from the Excel file, VINTCD0 contains non-zero values for most cases. I don't know why GAMS load all zero values to VINTCD0.

Cheers

Qiaomin

But displaying zero values is wrong. The parameters are non-zero. As you can see from the Excel file, VINTCD0 contains non-zero values for most cases. I don't know why GAMS load all zero values to VINTCD0.

Cheers

Qiaomin

### Re: Load zero values to GAMS from GDX File

If I run

the display statement shows

So I am not sure what you mean with

Fred

Code: Select all

```
parameter VD0, VINTCD0, VFACD0, VF0, VINTCF0, VFACF0, TAXM0, VT0, TN, VQH0, QG, QINV, FSAVD0, FSAVF0, FSAVK0, SIGMA, GAMMA, SIGMAP, ITA;
$call gdxxrw FRICTION.xlsx @FRICTION.txt
$gdxin FRICTION.gdx
$load VD0 VINTCD0 VFACD0 VF0 VINTCF0 VFACF0 TAXM0 VT0 TN VQH0 QG QINV FSAVD0 FSAVF0 FSAVK0 SIGMA GAMMA SIGMAP ITA
display VINTCD0;
```

Code: Select all

```
--- 7 PARAMETER VINTCD0
INDEX 1 = CN
A FOOD LABIN ITC PHAR MOTOR MACHI ELEQU MET TRANS RUB OTHMAN BUSSER FINA OTHSER
CN .A 262064.442 134049.373 3329.536 3488.131 4549.276 3157.484 41108.807 4537.742 17022.539 1158.032 16189.194 138904.305 155049.284 4469.498 90421.306
CN .FOOD 283840.176 255342.951 1895.295 227.071 827.369 232.538 2849.504 351.432 3425.236 18.953 15773.961 27797.424 87253.571 1460.835 48232.353
CN .LABIN 29912.540 15138.514 374366.445 194.510 136.332 110.865 5114.513 418.343 1113.090 29.439 12457.425 66133.524 79345.625 1094.048 33328.445
...
```

Best,I don't know why GAMS load all zero values to VINTCD0.

Fred

### Re: Load zero values to GAMS from GDX File

Thanks Fred,

I know where the problem is. It is the set. VINTCD0(c,i,j,s) requires the data to be arranged in Excel such that c,i,j discipline row dimension and s column dimension. I originally put i, j in row dimension and s,c in column dimension. And this cause a problem.

I don't know how to post pictures here, otherwise I will show this more clearly.

Anyway, thank Renger and Fred!

Cheers

Qiaomin

I know where the problem is. It is the set. VINTCD0(c,i,j,s) requires the data to be arranged in Excel such that c,i,j discipline row dimension and s column dimension. I originally put i, j in row dimension and s,c in column dimension. And this cause a problem.

I don't know how to post pictures here, otherwise I will show this more clearly.

Anyway, thank Renger and Fred!

Cheers

Qiaomin