how to display the current value of a set

Problems with syntax of GAMS
Post Reply
yanzhiping
User
User
Posts: 85
Joined: 11 months ago

how to display the current value of a set

Post by yanzhiping » 4 months ago

I am trying to extract the current value of a set, but failed.

set Yr /1*14/;
scalar YrOrd;
loop(Yr,
YrOrd=ord(Yr);
display YrOrd, Yr(YrOrd);
);

Does anyone know what is the issue with the code above?

Thanks.

Manassaldi
User
User
Posts: 45
Joined: 1 year ago
Location: Rosario - Argentina

Re: how to display the current value of a set

Post by Manassaldi » 4 months ago

Hi, you can try this..

set Yr /1*14/;
scalar YrOrd;
loop(Yr,
YrOrd=ord(Yr);
display YrOrd;
);

or

set Yr /1*14/;
parameter YrOrd(Yr);
loop(Yr,
YrOrd(Yr)=ord(Yr);
);

display YrOrd;

Post Reply