Usage

Top  Previous  Next

Acronyms can be used in scalar, parameter and table statements as well as in calculation - assignment statements and conditionals.

Examples:

(acronym.gms)

acronyms nameforit,nextone;

acronym  acronym3  the third one

acronym  doit any old acronym

set i /i1, i2, i3 /;

parameter textstrings(i)

     /i1 nameforit,     i2 nextone,      i3 acronym3/ ;

parameter textstring(i)

     /i1 doit,      i2 1,      i3 doit/ ;

display textstrings;

file putacronym;

put putacronym;

put nameforit //

loop(i,if(textstrings(i)nameforit, put 'Something');

put textstrings(i) / );

scalar flagtome;

flagtome=doit;

equation aa(i);

variables x(i);

aa(i)$(textstring(i)=doit).. 3*x(i)=e=1;

display flagtome,textstring;

parameter zz(i),rr(i);

zz(i)=textstring(i)  ;

display zz;

table acks(i,i)

              i1              i2             i3

i1                                          doit

i2                           doit

i3           doit;

display acks;

Notes:

Scalar, parameter, or table statements are entered as described in the Data Entry chapter with acronym names used wherever numbers could be entered.
Conditionals can be used, but when dealing with acronyms you can only use eq or ne operators not gt or lt.
When acronyms are included in Assignment statements the statements can only set other items equal to acronyms or other parameters containing acronyms.
Numerical operations (+ - * / **) cannot be done with acronyms.
Numbers can be mixed in with acronyms in a parameter that is defined over a set or sets, but once the acronym is in the parameter then that parameter cannot be subsequently manipulated numerically.