loop - with "if current set element" inside

Problems with syntax of GAMS
Post Reply
MES
User
User
Posts: 14
Joined: 4 years ago

loop - with "if current set element" inside

Post by MES »

Hi,

I want to loop the set Abs. The if function should do some statements, if the current set element is "Basis1".
What´s the Synatx for this?

Code: Select all

set Abs / "Basis1", "Basis2" /;

loop (Abs,

if       ([b]HOW TO DO THE SYNTAX?[/b],
         ... ;
         );
...
);
Thank you very much!
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: loop - with "if current set element" inside

Post by Renger »

Hi

You could use "sameas":

Code: Select all

loop(abs, 
      b(abs) = 2;
      b$(sameas(abs, "Basis1") = 4;
      
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply