Command Reference : User Objects : Unregistered User Objects
Unregistered User Objects
To create a new, unregistered user object, select Object/New Object in the main EViews menu.
Scroll down and select UserObj, enter a name for the object in the workfile (in this example, MYOBJ), and click on OK. Alternately, you may enter the generic user object declaration command
userobj myobj
to create a user object named MYOBJ in the workfile.
Notice that MYOBJ has a black icon. A user object created in this fashion is empty, with no user-defined views or procedures. Double-clicking on MYOBJ opens the object and displays its contents:
As you can see, the object is empty. Clicking on the View menu of the object shows only a single Label entry. The Proc menu is completely empty.
An empty, unregistered userobj is not particularly interesting. You may, however, use the object as a container for EViews matrix objects (including scalars), string objects, estimation objects, and view objects (graphs, tables, spools):
The add and drop procs may be used to populate the user object and the extract proc may be employed to extract objects into the workfile.
You may use user object data members to provide information about the contents of the object: the @hasmember(obname) member function can be used to determine whether obname exists inside the user object, while @members returns a space delimited string listing all objects in the user object.
See “User Object Programming Support” for details.
The following program offers a simple example showing the use of these commands:
userobj myobj
myobj.add mygraph
myobj.add mytable
%list = myobj.@members
myobj.drop mygraph
myobj.extract mytable mynewtable
The first line creates a new, empty, user object called “MYOBJ”. The second and third lines copy the workfile objects “MYGRAPH” and “MYTABLE” into MYOBJ. The fourth line creates a string variable whose contents are “mygraph mytable”. The fifth line removes MYGRAPH from MYOBJ, and the final line copies MYTABLE back into the workfile under the name MYNEWTABLE.