how to display the current value of a set

Problems with syntax of GAMS
yanzhiping
User
User
Posts: 85
Joined: 9 months ago

how to display the current value of a set

Postby yanzhiping » 2 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: 44
Joined: 10 months ago
Location: Rosario - Argentina

Re: how to display the current value of a set

Postby Manassaldi » 2 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;


Who is online

Users browsing this forum: Bing [Bot] and 1 guest