Object Reference : Object View and Procedure Reference : Sample
  
Sample
 
String values
clearhist
clearremarks
copy
display
displayname
label
olepush
sample
set
setattr
spec
Sample of observations. Description of a set of observations to be used in operations.
Sample Declaration
sample declare a sample object.
To declare a sample object, use the keyword sample, followed by a name and a sample string:
sample mysample 1960:1 1990:4
sample altsample 120 170 300 1000 if x>0
Sample Views
display display table, graph, or spool in object window.
label label information for the sample.
spec display sample specification information.
Sample Procs
clearhist clear the contents of the history attribute.
clearremarks clear the contents of the remarks attribute.
copy creates a copy of the sample.
displayname set display name.
olepush push updates to OLE linked objects in open applications.
set reset the sample range.
setattr set the value of an object attribute.
Sample 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 Sample object’s description (if available).
@detailedtype string with the object type: “SAMPLE”.
@displayname string containing the Sample object’s display name. If the Sample has no display name set, the name is returned.
@name string containing the Sample object’s name.
@remarks string containing the Sample object’s remarks (if available).
@type string with the object type: “SAMPLE”.
@updatetime string representation of the time and date at which the Sample was last updated.
Sample Example
To change the observations in a sample object, you can use the set proc:
mysample.set 1960:1 1980:4 if y>0
sample thesamp 1 10 20 30 40 60 if x>0
thesamp.set @all
To set the current sample to use a sample, enter a smpl statement, followed by the name of the sample object:
smpl mysample
equation eq1.ls y x c
clearhist
Clear the contents of the history attribute for sample objects.
Removes the sample’s history attribute, as shown in the label view of the sample.
Syntax
sample_name.clearhist
Examples
s1.clearhist
s1.label
The first line removes the history from the sample 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 Sample::label.
clearremarks
Clear the contents of the remarks attribute.
Removes the sample’s remarks attribute, as shown in the label view of the sample.
Syntax
sample_name.clearremarks
Examples
s1.clearremarks
s1.label
The first line removes the remarks from the sample 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 Sample::label.
copy
Creates a copy of the sample.
Creates either a named or unnamed copy of the sample.
Syntax
sample_name.copy
sample_name.copy dest_name
Examples
s1.copy
creates an unnamed copy of the sample S1.
s1.copy s2
creates S2, a copy of the sample S1.
Cross-references
See also copy.
display
Display table, graph, or spool output in the sample object window.
Display the contents of a table, graph, or spool in the window of the sample object.
Syntax
sample_name.display object_name
Examples
sample1.display tab1
Display the contents of the table TAB1 in the window of the object SAMPLE1.
Cross-references
Most often used in constructing an EViews Add-in. See “Custom Object Output”.
displayname
Display name for sample objects.
Attaches a display name to a sample object which may be used to label output in place of the standard sample object name.
Syntax
sample_name.displayname display_name
Display names are case-sensitive, and may contain a variety of characters, such as spaces, that are not allowed in sample object names.
Examples
sm1.displayname Annual Sample
sm1.label
The first line attaches a display name “Annual Sample” to the sample object SM1, and the second line displays the label view of SM1, including its display name.
Cross-references
See “Labeling Objects” for a discussion of labels and display names.
See also Sample::label.
label
Display or change the label view of a sample object, including the last modified date and display name (if any).
As a procedure, label changes the fields in the sample object label.
Syntax
sample_name.label
sample_name.label(options) [text]
Options
The first version of the command displays the label view of the sample object. The second version may be used to modify the label. 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 sample SP1 with “1988 March”
sp1.label(r)
sp1.label(r) 1988 March
To append additional remarks to SP1, and then to print the label view:
sp1.label(r) if X is greater than 3
sp1.label(p)
Cross-references
See “Labeling Objects” for a discussion of labels.
See also Sample::displayname.
olepush
Push updates to OLE linked objects in open applications.
Syntax
sample_name.olepush
Cross-references
See “Object Linking and Embedding (OLE)” for a discussion of using OLE with EViews.
sample
Declare a sample object.
The sample statement declares, and optionally defines, a sample object.
Syntax
sample smpl_name [smpl_statement]
Follow the sample keyword with a name for the sample object and a sample statement. If no sample statement is provided, the sample object will be set to the current workfile sample.
To reset the sample dates in a sample object, you must use the Sample::set procedure.
Examples
sample ss
declares a sample object named SS and sets it to the current workfile sample.
sample s2 1974q1 1995q4
declares a sample object named S2 and sets it from1974Q1 to 1995Q4.
sample fe_bl @all if gender=1 and race=3
smpl fe_bl
The first line declares a sample FE_BL that includes observations where GENDER=1 and RACE=3. The second line sets the current sample to FE_BL.
sample sf @last-10 @last
declares a sample object named SF and sets it to the last 10 observations of the current workfile range.
sample s1 @first 1973q1
s1.set 1973q2 @last
The first line declares a sample object named S1 and sets it from the beginning of the workfile range to 1973Q1. The second line resets S1 from 1973Q2 to the end of the workfile range.
sample s2 @all if @hourf<=9.5 and @hourf<=14.5
declares a sample S2 that includes all observations that are between 9:30AM and 2:30PM.
Cross-references
See “Samples”and “Dates” for a discussion of using samples and dates in EViews.
See also Sample::set and smpl.
set
Set the sample in a sample object.
The set procedure resets the sample of an existing sample object.
Syntax
sample_name.set(options) sample_description
Follow the set command with a sample description. See sample for instructions on describing a sample.
Options
prompt
Force the dialog to appear from within a program.
Examples
sample s1 @first 1973
s1.set 1974 @last
The first line declares and defines a sample object named S1 from the beginning of the workfile range to 1973. The second line resets S1 from 1974 to the end of the workfile range.
Cross-references
See “Samples” for a discussion of samples in EViews.
See also Sample::sample, Sample::spec, and smpl.
setattr
Set the object attribute.
Syntax
sample_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”.
spec
Display the sample in a sample object.
The spec procedure displays the sample in an existing sample object.
Syntax
sample_name.spec(options)
Options
p
Print the sample specification
Examples
sample s1 @first 1973
s1.spec
The first line declares and defines a sample object named S1 from the beginning of the workfile range to 1973. The second line displays the sample specification.
Cross-references
See “Samples” for a discussion of samples in EViews.
See also Sample::sample, Sample::set, and smpl.