You will have to use the eval
feature, which has been added to GAMS in distribution 147. I also include an example to compute N+1 from N:
$ontext If you want to do something like $setglobal N 10 set i /1*(%N%+1)/ here's how. $offtext * force a compilation error if we don't run GAMS Rev 147 or higher $version 147 * if we get here we're new enough to use the $eval feature $setglobal N 10 $eval NP1 %N%+1 set I / 1 * %NP1% /; display I;
Finally, some details about what GAMS systems will support: the $eval
call is mentioned in our release notes for distribution 22.6 (GAMS Base Rev 149), but it is actually available in some form in Distribution 22.4 (GAMS Base Rev 147).