Item name rules

Top  Previous  Next

The statements declaring sets, scalars, parameters, tables, files, acronyms, variables, equations and models all name items.   The names for these items must follow a set of rules.  The name of any item

Can be up to 63  characters long, if not using MPSGE.
Must start with an alphabetic character.
Can contain both alphabetic and numeric characters.
Cannot contain spaces.
Cannot contain special characters excepting an _ (underscore).
Can be typed and referenced in a case insensitive manner but the case structure used in the first occurrence of the name will be the way it is printed out.
Should in my opinion for readability and definition be long enough so that the names are explanatory as argued in the Writing Models and Good Modeling Practices chapter.
MPSGE is limited to 10 character set names.  Also if you use a set to index subsets in an CES function, the limit if 4 characters.

Examples:

Below the item names are in red (namerules.gms)

 

 Variable         A6item;

 Set              shoes                /tennis,dress/;

 Parameter here_is_a_long_name         /1/;

 Equation         Wheredidiputmy(shoes);

 Acronym        Monday, a6data, a7_it;