Command Reference : Working with Spools : Working with a Spool
Working with a Spool
Adding Objects
Printing to a Spool
Appending and Inserting
Naming Objects
Object Displaynames
Object Comments
Removing Objects
Extracting Objects
Customizing the Spool
Titles and Comments
Customizing the Appearance
Spool objects provide easy-to-use tools for working with the objects in the spool. Among other things, you may manage (add, delete, extract, rearrange, hide) or customize (resize, space and indent, title and comment, and edit) the spool and the individual objects in a spool.
Adding Objects
You may add objects to a spool by printing to the spool, or by using the Spool::append and Spool::insert procs.
Printing to a Spool
Earlier, we saw how one may redirect subsequent print jobs to the spool object using the output command to change the default print destination. Once redirection is in place, simply use the print command or the “p” option to send view or procedure output to the spool. The following command lines:
output(s) myOldSpool
eq1.wald(p) c(1)=c(2)
redirect output to the existing spool object MYOLDSPOOL, then adds a line graph of SER01, a scatterplot of the series in GRP01, and the table output of a Wald test for equation EQ1 to the spool, in that order.
Note that the three output objects in the spool will be named UNTITLED01, UNTITLED02, and UNTITLD03.
To turn off redirection, simply issue the command:
output off
Appending and Inserting
You may use the Spool::append procedure to add output objects to the end of an existing spool object. You may insert any valid EViews object view into a spool. For example,
spool01.append ser01.line
appends a line graph of SER01 to the end of SPOOL01.
The name of the object in the spool will be the next available name beginning with “UNTITLED”. For example, if two objects have already been appended to SPOOL01, named UNTITLED01 and UNTITLED02, then the line graph of SER01 will be named UNTITLED03.
You may append multiple EViews objects using a single append command:
spool03.append ser02.line ser03
appends a line graph of SER02 and the default spreadsheet view of SER03 to the end of SPOOL03.
The Spool::insert proc offers additional control over the location of the added object by allowing you to specifying an integer position for the inserted object. If a position is not specified or the specified position is greater than the number of objects already in the spool, the object will be appended to the end. The command:
spool01.insert(loc=3) series01
inserts the default spreadsheet view of SERIES01 into SPOOL01 at position three. All existing objects in the spool from position three and higher are pushed down in the list to accommodate the new object.
You may include more than one object view using a single insert command:
spool01.insert(loc=5) "eq1.wald c(1)=c(2)" series01.uroot
inserts both the results for a Wald test on EQ1, and the results for a unit root test for SERIES01 into the spool in the fifth and sixth positions. Existing objects from the fifth position onward will be moved down to the seventh position so that they follow the unit root table. Note that since the Wald test command contains spaces, we require the use of double quotes to delimit the expression.
Alternately, insert accepts an object name for the location and an optional offset keyword. The command:
spool01.insert(loc=obj3) mycity.line
adds the line graph view of MYCITY to SPOOL01, placing it before OBJ3. You may modify the default positioning by adding the “offset=after” option,
spool01.insert(loc=obj3, offset=after) mycity.line
so that the line graph is inserted after OBJ3.
You may use insert or append to add spool objects to a spool. Suppose that we have the spool objects SPOOL01 and STATESPOOL. Then
spool01.insert statespool
adds STATESPOOL to the end of SPOOL01.
Subsequent insert commands may be used to place objects before, after, or inside of the spool object. The commands
spool01.insert(loc=state) mycity.line
spool01.insert(loc=state, offset=after) mytown.hist
inserts a line graph view of MYCITY before, and the histogram view of MYTOWN after the STATE spool. You may also use the “offset=” option to instruct EViews to place the new output object inside of an embedded spool:
spool01.insert(loc=state, offset=first) mycity.boxplot
spool01.insert(loc=state, offset=last) mystate.stats
places a boxplot view of MYCITY and a descriptive statistics view of MYSTATE inside of the STATE spool object. The boxplot view is inserted at the beginning of STATE, while the descriptive statistics view is appended to the end of STATE.
Objects within a embedded spool should be referred to using the full path description. For example, suppose we have a spool object COUNTY which we wish to add to the end of the previously embedded spool STATE. Then,
spool01.insert(loc=state, offset=last) county
inserts COUNTY as the last member of the spool STATE, and:
spool01.insert(loc=state/county, offset=first)
inserts a bar graph of MYCITY into the first position of the COUNTY spool.
Naming Objects
The default name of an object when it is inserted into a spool is UNTITLED followed by the next available number (e.g. UNTITLED03). When using the Spool::append or the Spool::insert procs may use the “name=” option to specify a name.
Alternately, you may use the Spool::name command to change the name of an object in the spool. For example, untitled03 losangeles
renames the UNTITLED03 object to LOSANGELES. Note that names are not case-sensitive, and that they must follow EViews’ standard naming conventions for objects. Names must also uniquely identify objects in the spool.
To rename an object contained in an embedded spool, you should provide the full path description of the object. For example, the command: untitled01/untitled02 newyork
renames the object UNTITLED02 which is contained in the spool UNITITLED01 to NEWYORK.
Object Displaynames
The Spool::displayname proc may also be used to alter the display name of an object. The default display name of an object is simply the uppercase version of the object name. Display names, which are case-sensitive, not restricted to be valid object names, and need not be unique, allow you to provide a more descriptive label in the tree pane view when displaying object names.
For example,
spool01.displayname untitled03 "Los Angeles"
sets the display name for UNTITLED03 object to the text “Los Angeles”. Note that since the desired display name has spaces, we have enclosed the text in double-quotes.
spool01.displayname untitled01/untitled02 "New York"
sets the display name for UNTITLED02 in the spool UNITITLED01 to “New York”.
Object Comments
The Spool::displayname may be used to assign a comment to an object in the spool. Setting a comment for an object is similar to setting the display name. Comments can be multiline; you may use “\n” to indicate the start of a new line in a comment.
Spool01.comment untitled01 "The state population of Alabama as found\nfrom"
assigns the following comment to object UNTITLED01:
“The state population of Alabama as found
Removing Objects
Use the Spool::remove proc to delete objects from a spool. Follow the remove keyword with names of the objects to be deleted. The unique object name should be used; the display name cannot be used as a valid argument for the remove command.
spool01.remove untitled02 untitled01 untitled03
removes the three objects UNTITLED01, UNTITLED02, UNTITLED03 from SPOOL01. Note that the order at which objects are specified is not important.
Extracting Objects
Objects within a spool are not confined to spools forever; they may be extracted to other spools using Spool::extract. An independent copy of the specified object will be made. Note that only one object may be extracted at a time. For instance, referring to our example above, where we have a STATE spool containing a COUNTY spool,
spool01.extract state/county
creates an untitled spool containing the objects in the COUNTY spool.
spool01.extract(mycounty) state/county
Customizing the Spool
Titles and Comments
Each object in a spool has both an object name and a display name. By default, the object name is shown. The object name is not case sensitive, while the display name can be multiple words and is case sensitive.
Setting a comment for an object is similar to setting the display name. Comments can be multiline; you may use “\n” to indicate the start of a new line in a comment.
Spool01.comment untitled01 "The state population of Alabama as found\nfrom"
assigns the following comment to object UNTITLED01:
“The state population of Alabama as found
Customizing the Appearance
General properties of a spool may be modified using the Spool::options proc. These properties include the display of the object tree, borders, titles, comments, and the use of the object name or display name. To change these settings, use the options keyword followed by the characteristic you wish to change.
To turn off the tree and display titles, displaynames and comments for SPOOL01:
spool01.options -tree titles displaynames comments
creates a spool with the same objects and names it MYCOUNTY.