Scalar
Scalar (single number). A scalar holds a single numeric value. Scalar values may be used in standard EViews expressions in place of numeric values.
Scalar Declaration
To declare a scalar object, use the keyword scalar, followed by a name, an “=” sign and a scalar expression or value.
Scalar Views
display display table, graph, or spool in object window.
sheet spreadsheet view of the scalar.
Scalar Procs
clearhist clear the contents of the history attribute.
copy creates a copy of the scalar.
olepush push updates to OLE linked objects in open applications.
setattr set the value of an object attribute.
Scalar Data Members
String values
@attr("arg") string containing the value of the arg attribute, where the argument is specified as a quoted string.
@description string containing the Scalar object’s description (if available).
@detailedtype string with the object type: “SCALAR”.
@displayname string containing the Scalar object’s display name. If the Scalar has no display name set, the name is returned.
@name string containing the Scalar object’s name.
@remarks string containing the Scalar object’s remarks (if available).
@type string with the object type: “SCALAR”.
@updatetime string representation of the time and date at which the Scalar was last updated.
Scalar Examples
You can declare a scalar and examine its contents in the status line:
scalar pi=3.14159
scalar shape=beta(7)
show shape
or you can declare a scalar and use it in an expression:
scalar inner=@transpose(mydata)*mydata
series x=1/@sqrt(inner)*y
Clear the contents of the history attribute.
Removes the scalar’s history attribute, as shown in the label view of the scalar.
Syntax
scalar_name.clearhist
Examples
s1.clearhist
s1.label
The first line removes the history from the scalar S1, and the second line displays the label view of S1, including the now blank history field.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Clear the contents of the remarks attribute.
Removes the scalar’s remarks attribute, as shown in the label view of the scalar.
Syntax
scalar_name.clearremarks
Examples
s1.clearremarks
s1.label
The first line removes the remarks from the scalar S1, and the second line displays the label view of S1, including the now blank remarks field.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Creates a copy of the scalar.
Creates either a named or unnamed copy of the scalar.
Syntax
scalar_name.copy
scalar_name.copy dest_name
Examples
s1.copy
creates an unnamed copy of the scalar S1.
s1.copy s2
creates S2, a copy of the scalar S1.
Cross-references
Display table, graph, or spool output in the scalar object window.
Display the contents of a table, graph, or spool in the window of the scalar object.
Syntax
scalar_name.display object_name
Examples
scalar1.display tab1
Display the contents of the table TAB1 in the window of the object SCALAR1.
Cross-references
Most often used in constructing an EViews Add-in. See
“Custom Object Output”.
Display name for a scalar object.
Attaches a display name to a scalar object which may be used to label output in place of the standard scalar object name.
Syntax
scalar_name.displayname display_name
Display names are case-sensitive, and may contain a variety of characters, such as spaces, that are not allowed in scalar object names.
Examples
sc.displayname Hours Worked
sc.label
The first line attaches a display name “Hours Worked” to the scalar object SC, and the second line displays the label view of SC, including its display name.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names. See also
Scalar::label.
Display or change the label view of the scalar object, including the last modified date and display name (if any).
Syntax
scalar_name.label
scalar_name.label(options) text
Options
To modify the label, you should specify one of the following options along with optional text. If there is no text provided, the specified field will be cleared:
c | Clears all text fields in the label. |
d | Sets the description field to text. |
s | Sets the source field to text. |
u | Sets the units field to text. |
r | Appends text to the remarks field as an additional line. |
p | Print the label view. |
Examples
The following lines replace the remarks field of the scalar S1 with “Mean of Dependent Variable from EQ3”:
s1.label(r)
s1.label(r) Mean of Dependent Variable EQ3
Cross-references
See
“Labeling Objects” for a discussion of labels.
Push updates to OLE linked objects in open applications.
Syntax
scalar_name.olepush
Cross-references
See
“Object Linking and Embedding (OLE)” for a discussion of using OLE with EViews.
Declare a scalar object.
The scalar command declares a scalar object and optionally assigns a value.
Syntax
scalar scalar_name[=assignment]
The scalar keyword should be followed by a valid name, and optionally, by an assignment. If there is no explicit assignment, the scalar will be initialized with a value of zero.
Examples
scalar alpha
declares a scalar object named ALPHA with value zero.
equation eq1.ls res c res(-1 to -4) x1 x2
scalar lm = eq1.@regobs*eq1.@r2
show lm
runs a regression, saves the

as a scalar named
LM, and displays its value in the status line at the bottom of the EViews window.
Set the object attribute.
Syntax
scalar_name.setattr(attr) attr_value
Sets the attribute attr to attr_value. Note that quoting the arguments may be required. Once added to an object, the attribute may be extracted using the @attr data member.
Examples
a.setattr(revised) never
String s = a.@attr("revised")
sets the “revised” attribute in the object A to the string “never”, and extracts the attribute into the string object S.
Cross-references
Spreadsheet view of a scalar object.
Syntax
scalar_name.sheet(options)
Options
p | Print the spreadsheet view. |
Examples
s01.sheet
displays the spreadsheet view of S01.