Object Reference : Object View and Procedure Reference : String
  
String
 
String values
clearhist
clearremarks
copy
display
displayname
label
list
olepush
setattr
sheet
string
String object. String objects may be used in standard EViews expressions in place of string literals.
String Declaration
string declare string object.
To declare a string object, use the keyword string, followed by a name, an “=” sign and a text string.
String Views
display display table, graph, or spool in object window.
label label view.
list list view display of the string.
sheet display the string.
String Procs
clearhist clear the contents of the history attribute.
clearremarks clear the contents of the remarks attribute.
copy creates a copy of the string.
displayname set display name.
olepush push updates to OLE linked objects in open applications.
setattr set the value of an object attribute.
String 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 String object’s description (if available).
@detailedtype string with the object type: “STRING”.
@displayname string containing the String object’s display name. If the String has no display name set, the name is returned.
@name string containing the String object’s name.
@remarks string containing the String object’s remarks (if available).
@type string with the object type: “STRING”.
@updatetime string representation of the time and date at which the String was last updated.
String Examples
You can declare a string and examine its contents:
string st="Hello world"
show st
clearhist
Clear the contents of the history attribute.
Removes the string’s history attribute, as shown in the label view of the string.
Syntax
string_name.clearhist
Examples
s1.clearhist
s1.label
The first line removes the history from the string 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.
See also String::label.
clearremarks
Clear the contents of the remarks attribute.
Removes the string’s remarks attribute, as shown in the label view of the string.
Syntax
string_name.clearremarks
Examples
s1.clearremarks
s1.label
The first line removes the remarks from the string 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.
See also String::label.
copy
Creates a copy of the string.
Creates either a named or unnamed copy of the string.
Syntax
string_name.copy
string_name.copy dest_name
Examples
s1.copy
creates an unnamed copy of the string S1.
s1.copy s2
creates S2, a copy of the string S1.
Cross-references
See also copy.
display
Display table, graph, or spool output in the string object window.
Display the contents of a table, graph, or spool in the window of the string object.
Syntax
string_name.display object_name
Examples
string1.display tab1
Display the contents of the table TAB1 in the window of the object STRING1.
Cross-references
Most often used in constructing an EViews Add-in. See “Custom Object Output”.
displayname
Display name for the string objects.
Attaches a display name to a string object which may be used to label output in place of the standard object name.
Syntax
string_name.displayname display_name
Display names are case-sensitive, and may contain a variety of characters, such as spaces, that are not allowed in matrix object names.
Examples
str1.displayname Patagonian Toothfish Name
str1.label
The first line attaches a display name “Patagonian Toothfish Name” to the string object STR1, and the second line displays the label view of STR1, including its display name.
Cross-references
See “Labeling Objects” for a discussion of labels and display names.
See also String::label.
label
Display or change the label view of the string object, including the last modified date and display name (if any).
Syntax
string_name.label
string_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 string S1 with “Name of Dependent Variable from EQ3”:
s1.label(r)
s1.label(r) Name of Dependent Variable EQ3
Cross-references
See “Labeling Objects” for a discussion of labels.
list
List view of a string object.
Syntax
string_name.list(options)
Options
p
Print the list view.
Examples
s01.list
displays the text of the string in S01 in list format with one word per line.
Cross-references
See String::sheet for an alternative formatted view of the string contents.
olepush
Push updates to OLE linked objects in open applications.
Syntax
string_name.olepush
Cross-references
See “Object Linking and Embedding (OLE)” for a discussion of using OLE with EViews.
setattr
Set the object attribute.
Syntax
string_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
See “Adding Custom Attributes in the Label View” and “Adding Your Own Label Attributes”.
sheet
Spreadsheet view of a string object.
Syntax
string_name.string(options)
Options
p
Print the spreadsheet view.
Examples
s01.string
displays the text of the string in S01.
Cross-references
See String::list for an alternative formatted view of the string contents.
string
Declare a string object.
The string command declares a string object and optionally assigns text.
Syntax
string string_name[=assignment]
The string 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 null.
Examples
string alpha
declares a string object named ALPHA containing no text.
You may also create a string that includes quotes:
string lunch = "Apple Tuna Cookie"
string dinner = """Chicken Marsala"" ""Beef Stew"" Hamburger"
creates the string objects LUNCH and DINNER, each containing the corresponding string literal. We have used the double quote character in the DINNER string as an escape character for double quotes.
Cross-references
See “Strings” and “String Objects” for a discussion of strings and string objects.