how to display the current value of a set

Problems with syntax of GAMS
Post Reply
yanzhiping
User
User
Posts: 85
Joined: 1 year ago

how to display the current value of a set

Post by yanzhiping » 1 year 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: 66
Joined: 1 year ago
Location: Rosario - Argentina

Re: how to display the current value of a set

Post by Manassaldi » 1 year 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;

Vickery
User
User
Posts: 1
Joined: 8 months ago

Re: how to display the current value of a set

Post by Vickery » 7 months ago

Manassaldi that did not work for me. :(

User avatar
bussieck
Moderator
Moderator
Posts: 198
Joined: 2 years ago

Re: how to display the current value of a set

Post by bussieck » 7 months ago

Manassaldi code had no issues and addresses your original question. Why don't you tell us what does not work for you.

-Michael

Post Reply