Command Reference : Working with Tables and Spreadsheets : Creating a Table
Creating a Table
Creating Tables from an Object View
Declaring Tables
There are two basic ways to create a table object: by freezing an object view, or by issuing a table declaration.
Creating Tables from an Object View
You may create a table object from another object, by combining an object view command with the freeze command. Simply follow the freeze keyword with an optional name for the table object, and the tabular view to be frozen. For example, since the command
displays the statistics view of the group GRP6, the command
freeze(mytab) grp6.stats
creates and displays a table object MYTAB containing the contents of the previous view.
You should avoid creating unnamed tables when using commands in programs since you will be unable to refer to, or work with the resulting object using commands. If the MYTAB option were omitted in the previous example, EViews would create and display an untitled table object. This table object may be customized interactively, but may not be referred to in programs. You may, of course, assign a name to the table interactively.
Once you have created a named table object, you may use the various table object procs to further customize the appearance of your table. See “Customizing Tables”.
Declaring Tables
To declare a table, indicate the number of rows and columns and provide a valid name. For example:
table(10,20) bestres
creates a table with 10 rows and 20 columns named BESTRES. You can change the size of a table by declaring it again. Re-declaring the table to a larger size does not destroy the contents of the table; any cells in the new table that existed in the original table will contain their previous values.
Tables are automatically resized when you attempt to fill a table cell outside the table’s current dimensions. This behavior is different from matrix objects which issue an error when an out-of-range element is accessed.