loop - with "if current set element" inside

Problems with syntax of GAMS
Post Reply
MES
User
User
Posts: 14
Joined: 1 year ago

loop - with "if current set element" inside

Post by MES » 7 months ago

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: 585
Joined: 3 years ago

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

Post by Renger » 7 months ago

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