Scalars

Top  Previous  Next

A SCALAR declaration is used to enter items that are not defined with respect to sets.   The general form of the SCALAR entry is

 

scalar

  item1name             optional explanatory text    /numerical value/

  item2name             optional explanatory text    /numerical value/

 ...                                        ;

or

scalars

  item1name             optional explanatory text    /numerical value/

  item2name             optional explanatory text    /numerical value/

 ...                                        ;

Examples:

(scalar.gms)

scalar    dataitem      /100/;

scalar    landonfarm    total arable acres /100/;

scalars   landonfarms   /100/

    cost           /-10.02/

    pricecorn       1992 corn price per bushel  /2.20/;

scalars   a1 ,   a2 ,  a3 /5/;

scalar    withnodata  enter a scalar without data;

Notes:

Scalar names plus the explanatory text must obey the rules presented in the Rules for Item Names, Element names and Explanatory Text chapter.
Labels and long explanatory names should be used where possible as argued in the Writing Models and Good Modeling Practices chapter.
SCALAR or SCALARS can be used interchangeably.
More than one named scalar is definable under a single scalar statement with a semicolon terminating the total statement.
Multiple named scalars can be defined in a line set off with commas.
Data do not have to be entered in the scalar statement, but rather can be defined later with replacement (=) statement calculations or assignments.
Scalars are a specific input entry format for the general GAMS parameter class of items that also encompasses Tables.