Let’s say I have a parameter check(r). For some r it has assigned values and these values can be 0. For other r, check(r) has no assigned values.
For example, imagine that we have a set r with four elements 1*4 and the parameter check(r) is defined as following:
check(r) /1=0.1, 2=0, 3=-5/;
I want to use this parameter to define the condition “if check(r) has assigned value then…”. The condition “check(r) ne 0” does not work for me, because the desired condition should return True even for check(‘2’). The only False value shoud be for check('4). How can I do it in GAMS?

Default value for any parameter is 0. Therefore, there is no such thing as unassigned value when it comes to parameters.
You can make use of the nature of your data (if your data is positive, initialize your parameter to a negative value and use that as an indicator) or by changing zeros in your data to eps. Or by creating a subset that can keep track of assigned value.

Thank you, abhosekar. I have created a map to overcome this issue.
How replasing 0 with EPS can help? The condition “ne 0” is False for both zero and EPS values. Is there a way to distinguish 0 and EPS?

You are right, eps was a wrong choice. something relatively small like 1e-4 (not eps) would work. The point is to be able to distinguish it from data. Mapping is also a good idea.

You can also check for eps with the mapval function (https://www.gams.com/latest/docs/UG_Parameters.html#INDEX_functions_22_mapVal). The following example assigns random integers and makes the zero to eps (by always adding eps). The assignment to count_eps counts how often we got an eps using the mapval function:

set i / i1*i50 /; parameter p(i);
p(i) = uniformInt(-5,5) + eps;
scalar count_eps;
count_eps = sum(i$(mapval(p(i))=mapval(eps)), 1)
display count_eps;

Thanks a lot, bussieck. Your reference to mapval helps a lot.
So what I was looking for can be formulated as the condition: $(check(i) ne 0 or mapval(check(i)) eq 8). Certainly, the assigned zeroes in my parameter should be denoted as EPS to distinguish them from the unassigned values: