We are reading parameter data in from a GDX file (created using either GDXXRW and Excel or via Python depending on our application).

If the dataset did not have data entered for a given set of indexes, MY_PARAMETER(i,j) returns 0;

If the dataset did have data entered for a given set of indexes but that data was zero, MY_PARAMETER(i,j) returns 0;

Is there a way to determine if data was MISSING/NOT SPECIFIED vs explicitly set to zero when reading data from a GDX?

All help appreciated.

GAMS is a sparse system and does not store zeros. If you want to store a 0 in GAMS you turn it into an EPS. Numerically EPS is truly 0 (not a small number) but it “exists”. You can turn zeros (0) in data import into EPS with the compile time dollar control option $on/offEPS (see https://www.gams.com/36/docs/UG_DollarControlOptions.html#DOLLARonoffeps) or at execution with the option zeroToEPS (see https://www.gams.com/36/docs/UG_GamsCall.html#GAMSAOzerotoeps). GDX does store true zeros so that this conversion works, but depending on the tool that wrote the GDX file (you mention GDXXRW) you might need to do some “extra” work that the zeros in Excel (or whatever your original data source is) make it as zeros into GDX. For example reading an Excel workbook with data like this

with the command “gdxxrw Book1.xlsx par=p rng=Sheet1!a1 rdim=1 cdim=0” the records with 0 don’t make it into the GDX file:

adding the switch Squeeze=N to gdxxrw make the tool store default values (zeros for parameters) in GDX and we see the zeros stored in this case:

but the blank cell (with label “4”) still did not make it as 0 into GDX.

If you read the latter GDX under default and display p:

```
set i /1*4/; parameter p(i);
$gdxin Book1
$load p
display p;
```

you get:

```
---- 4 PARAMETER p
1 EPS
```

If you add $onEPS before the $load you get

```
---- 5 PARAMETER p
1 EPS, 2 EPS, 3 EPS
```

-Michael