Rowvector
Row vector. (One dimensional array of numbers).
Rowvector Declaration
There are several ways to create a rowvector object. First, you can enter the rowvector keyword (with an optional dimension) followed by a name:
rowvector scalarmat
rowvector(10) results
The resulting rowvector will be initialized with zeros.
Alternatively, you may combine a declaration with an assignment statement. The new rowvector will be sized and initialized accordingly:
rowvector(10) y=3
rowvector z=results
Rowvector Views
display display table, graph, or spool in object window.
edftest empirical distribution function tests.
hist descriptive statistics and histogram.
label label information for the rowvector.
sheet spreadsheet view of the rowvector.
stats descriptive statistics of the elements of the rowvector.
Rowvector Procs
clearhist clear the contents of the history attribute.
copy creates a copy of the rowvector.
distdata save a matrix containing distribution plot data computed from the rowvector.
export export rowvector as Excel 2007 XLSX, CSV, tab-delimited ASCII text, RTF, HTML, Enhanced Metafile, PDF, TEX, or MD file on disk.
fill fill elements of the rowvector.
import imports data from a foreign file into the rowvector object.
olepush push updates to OLE linked objects in open applications.
read (deprecated) import data from disk.
resize resize the rowvector object.
setattr set the value of an object attribute.
setformat set the display format for the rowvector spreadsheet.
setindent set the indentation for the rowvector spreadsheet.
setjust set the horizontal justification for all cells in the spreadsheet view of the rowvector object.
setwidth set the column width in the rowvector spreadsheet.
showlabels displays the custom row and column labels of a rowvector spreadsheet.
write export data to disk.
Rowvector Graph Views
Graph creation views are discussed in detail in
“Graph Creation Command Summary”.
bar bar graph of each column (element) of the data against the row index.
qqplot quantile-quantile graph.
scat scatter diagrams of the columns of the rowvector.
scatmat matrix of all pairwise scatter plots.
Rowvector Data Members
String values
@attr("arg") string containing the value of the arg attribute, where the argument is specified as a quoted string.
@collabels string containing the column labels of the rowvector.
@description string containing the Rowvector object’s description (if available).
@detailedtype string with the object type: “ROWVECTOR”.
@displayname string containing the Rowvector object’s display name. If the Rowvector has no display name set, the name is returned.
@name string containing the Rowvector object’s name.
@remarks string containing the Rowvector object’s remarks (if available).
@rowlabels string containing the row label of the rowvector.
@type string with the object type: “ROWVECTOR”.
@updatetime string representation of the time and date at which the Rowvector was last updated.
Scalar values
(i) i-th element of the rowvector. Simply append “(i)” to the rowvector name (without a “.”).
@cols number of columns in the rowvector.
Rowvector values
@col(arg) Returns the rowvector defined by arg. arg may be an integer, vector of integers, string, or svector of strings. Integers correspond to column numbers so that, for example, arg = 2 specifies the second column. Strings correspond to column labels so that arg = "2" specifies the first column labeled “2”.
@dropcol(arg) Returns the rowvector with the columns defined by arg removed. arg may be an integer, vector of integers, string, or svector of strings. Integers correspond to column numbers so that, for example, arg = 2 specifies the second column. Strings correspond to column labels so that arg = "2" specifies the first column labeled “2”.
@icol(arg) Returns the indices for the columns defined by arg where arg is a string or svector of strings. The strings correspond to column labels so that arg = "2" specifies the first column labeled “2”.
@t Returns transpose.
Rowvector Examples
To declare a rowvector and to fill it with data read from an Excel file:
rowvector(10) mydata
mydata.read(b2) thedata.xls
To access a single element of the rowvector using direct indexing:
scalar result1=mydata(2)
The rowvector may be used in standard matrix expressions:
vector transdata=@transpose(mydata)
Clear the column labels in a rowvector object.
Syntax
rowvector_name.clearcollabels
Examples
rvec1.clearcollabels
clears the custom column labels from the rowvector RVEC1.
Cross-references
Clear the contents of the history attribute.
Removes the rowvector’s history attribute, as shown in the label view of the rowvector.
Syntax
rowvector_name.clearhist
Examples
r1.clearhist
r1.label
The first line removes the history from the rowvector R1, and the second line displays the label view of R1, including the now blank history field.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Clear the contents of the remarks attribute.
Removes the rowvector’s remarks attribute, as shown in the label view of the rowvector.
Syntax
rowvector_name.clearremarks
Examples
r1.clearremarks
r1.label
The first line removes the remarks from the rowvector R1, and the second line displays the label view of R1, including the now blank remarks field.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Clear the row label in a rowvector object.
Syntax
rowvector_name.clearrowlabels
Examples
rvec1.clearrowlabels
clears the custom row label from the rowvector RVEC1.
Cross-references
Creates a copy of the rowvector.
Creates either a named or unnamed copy of the rowvector.
Syntax
rowvector_name.copy
rowvector_name.copy dest_name
Examples
r1.copy
creates an unnamed copy of the rowvector R1.
r1.copy r2
creates R2, a copy of the rowvector R1.
Cross-references
Display table, graph, or spool output in the rowvector object window.
Display the contents of a table, graph, or spool in the window of the rowvector object.
Syntax
rowvector_name.display object_name
Examples
rowvector1.display tab1
Display the contents of the table TAB1 in the window of the object ROWVECTOR1.
Cross-references
Most often used in constructing an EViews Add-in. See
“Custom Object Output”.
Display name for rowvector objects.
Attaches a display name to a rowvector object which may be used to label output in tables and graphs in place of the standard rowvector object name.
Syntax
vector_name.displayname display_name
Display names are case-sensitive, and may contain a variety of characters, such as spaces, that are not allowed in rowvector object names.
Examples
hrs.displayname Hours Worked
hrs.label
The first line attaches a display name “Hours Worked” to the rowvector object HRS, and the second line displays the label view of HRS, including its display name.
Cross-references
See
“Labeling Objects” for a discussion of labels and display names.
Save a matrix containing distribution plot data computed from the rowvector.
Saves the data used to display a histogram, kernel density, theoretical distribution, empirical CDF or survivor plot, or quantile plot to the workfile.
Syntax
rowvector_name.distdata(dtype=dist_type, dist_options) matrix_name
saves the distribution plot data specified by dist_type, where dist_type must be one of the following keywords:
hist | Histogram (default). |
freqpoly | Histogram Polygon. |
edgefreqpoly | Histogram Edge Polygon. |
ash | Average Shifted Histogram. |
kernel | Kernel density |
theory | Theoretical distribution. |
cdf | Empirical cumulative distribution function. |
survivor | Empirical survivor function. |
logsurvivor | Empirical log survivor function. |
quantile | Empirical quantile function. |
theoryqq | Theoretical quantile-quantile plot. |
Options
The theoretical quantile-quantile plot type “theoryqq” takes the options described in
qqplot under
“Theoretical Options”.
For the remaining types,
dist_options are any of the distribution type-specific options described in
distplot.
Note that the graph display specific options such as “fill,” “nofill,” and “leg,” and “noline” are not relevant for this procedure.
You may use the “prompt” option to force the dialog display
prompt | Force the dialog to appear from within a program. |
Examples
rvec1.distdata(dtype=hist, anchor=0, scale=dens, rightclosed) matrix01
creates the data used to draw a histogram from the rowvector RVEC1 with the anchor at 0, density scaling, and right-closed intervals, and stores that data in a matrix called MATRIX01 in the workfile.
rvec1.distdata(dtype=kernel, k=b, ngrid=50, b=.5) matrix02
generates the kernel density data computed with a biweight kernel at 50 grid points, using a bandwidth of 0.5 and linear binning, and stores that data in MATRIX02.
rvec1.distdata(dtype=theoryqq, q=o, dist=logit, p1=.5) matrix03
creates theoretical quantile-quantile data from RVEC1 using the ordinary quantile method to calculate quantiles. The theoretical distribution is the logit distribution, with the location parameter set to 0.5. The data is saved into the matrix MATRIX03.
Cross-references
For a description of distribution graphs and quantile-quantile graphs, see
“Analytical Graph Types”.
See also
distplot and
qqplot.
Computes goodness-of-fit tests based on the empirical distribution function.
Compute Kolmogorov-Smirnov, Lilliefors, Cramer-von Mises, Anderson-Darling, and Watson empirical distribution function tests.
Syntax
rowvector_name.edftest(options)
Options
General Options
dist=arg (default=”nomal”) | Distribution to test: “normal” (Normal distribution), “chisq” (Chi-square distribution), “exp” (Exponential distribution), “xmax” (Extreme Value - Type I maximum), “xmin” (Extreme Value Type I minimum), “gamma” (Gamma), “logit” (Logistic), “pareto” (Pareto), “uniform” (Uniform). |
p1=number | Specify the value of the first parameter of the distribution (as it appears in the dialog). If this option is not specified, the first parameter will be estimated. |
p2=number | Specify the value of the second parameter of the distribution (as it appears in the dialog). If this option is not specified, the second parameter will be estimated. |
p3=number | Specify the value of the third parameter of the distribution (as it appears in the dialog). If this option is not specified, the third parameter will be estimated. |
prompt | Force the dialog to appear from within a program. |
p | Print test results. |
Estimation Options
The following options apply if iterative estimation of parameters is required:
b | Use Berndt-Hall-Hall-Hausman (BHHH) algorithm. The default is Marquardt. |
m=integer | Maximum number of iterations. |
c=number | Set convergence criterion. The criterion is based upon the maximum of the percentage changes in the scaled coefficients. |
showopts / ‑showopts | [Do / do not] display the starting coefficient values and estimation options in the estimation output. |
s | Take starting values from the C coefficient vector. By default, EViews uses distribution specific starting values that typically are based on the method of the moments. |
Examples
The command
rvec1.edftest
uses the default settings to test whether the elements of the rowvector RVEC1 come from a normal distribution. Both the location and scale parameters are estimated from the data in RVEC1.
rvec1.edftest(type=chisq)
tests whether the data in RVEC1 follow a

distribution with degrees-of-freedom estimated from the data.
freeze(tab1) rvec1.edftest(type=chisq, p1=5)
tests whether the data in RVEC1 comes from a

distribution with 5 degrees-of-freedom. The output is stored in the table object
TAB1.
Cross-references
See
“Empirical Distribution Tests” for a description of the goodness-of-fit tests.
Export rowvector to disk as an Excel 2007 XLSX, CSV, tab-delimited ASCII text, RTF, HTML, Enhanced Metafile, LaTeX, PDF, or Markdown file.
Syntax
vector_name.export(options) [path\]file_name
Follow the keyword with a name for the file. file_name may include the file type extension, or the file type may be specified using the “t=” option.
If an explicit path is not specified, the file will be stored in the default directory, as set in the global options.
The base syntax for writing Excel 2007 files is:
vector_name.export(options) [path\]file_name [table_description]
where the table_description may contain:
• “range = arg”, where arg is top left cell of the destination Excel workbook, following the standard Excel format [worksheet!][topleft_cell[:bottomright_cell]].
If the worksheet name contains spaces, it should be placed in single quotes. If the worksheet name is omitted, the cell range is assumed to refer to the currently active sheet. If only a top left cell is provided, a bottom right cell will be chosen automatically to cover the range of non-empty cells adjacent to the specified top left cell. If only a sheet name is provided, the first set of non-empty cells in the top left corner of the chosen worksheet will be selected automatically. As an alternative to specifying an explicit range, a name which has been defined inside the Excel workbook to refer to a range or cell may be used to specify the cells to read.
Options
t=file_type (default=“csv”) | Specifies the file type, where file_type may be one of: “excelxml” (Excel 2007 (xml)),“csv” (CSV - comma-separated), “rtf” (Rich-text format), “txt” (tab-delimited text), “html” (HTML - Hypertext Markup Language), “emf” (Enhanced Metafile), “pdf” (PDF - Portable Document Format), “tex” (LaTeX), or “md” (Markdown). Files will be saved with the “.xlsx”, “.csv”, “.rtf”, “.txt”, “.htm”, “.emf”, “.pdf”, “.tex”, or “.md” extensions, respectively. |
s=arg | Scale size, where arg is from 5 to 200, representing the percentage of the original table size (only valid for HTML or RTF files). |
n=string | Replace all cells that contain NA values with the specified string. “NA” is the default. |
h / -h | Include(/do not include) column and row headers. The default is to not include the headers |
prompt | Force the dialog to appear from within a program. |
PDF Options
landscape | Save in landscape mode (the default is to save in portrait mode). |
size=arg (default=“letter”) | Page size: “letter”, “legal”, “a4”, and “custom”. |
width=number (default=8.5) | Page width in inches if “size=custom”. |
height=number (default=11) | Page height in inches if “size=custom”. |
leftmargin=number (default=0.5) | Left margin width in inches. |
rightmargin=number (default = 0.5) | Right margin width in inches. |
topmargin=number (default=1) | Top margin width in inches. |
bottommargin= number (default = 1) | Bottom margin width in inches. |
LaTeX Options
texspec / -texspec | [Include / Do not include] the full LaTeX documentation specification in the LaTeX output. The default behavior is taken from the global default settings. |
Excel Options
mode=arg | Specify whether to create a new file, overwrite an existing file, or update an existing file. arg may be “create” (create new file only; error on attempt to overwrite) or “update” (update an existing file, only overwriting the area specified by the range= table_description). If the “mode=” option is not used, EViews will create a new file, unless the file already exists in which case it will overwrite it. Note that the “mode=update” option is only available for Excel in 1) Excel versions through 2003, if Excel is installed, and 2) Excel 2007 (xml). Note: Excel does not need to be installed for Excel 2007 writing. |
Excel 2007 Options
mode=arg | Specify whether to create a new file, overwrite an existing file, or update an existing file. arg may be “create” (create new file only; error on attempt to overwrite) or “update” (update an existing file, only overwriting the area specified by the range= table_description). If the “mode=” option is not used, EViews will create a new file, unless the file already exists in which case it will overwrite it. Note that the “mode=update” option is only available for Excel in 1) Excel versions through 2003, if Excel is installed, and 2) Excel 2007 (xml). Note: Excel does not need to be installed for Excel 2007 writing. |
cellfmt=arg | Specify whether to use EViews, pre-existing, or remove cell formatting (colors, font, number formatting when possible, column widths and row heights) for the written range. arg may be “eviews” (replace current formatting in the file with the same cell formatting in EViews), “preserve” (leave current cell formatting already in the Excel file), or “clear” (remove current formatting and do not replace). |
strlen=arg (default = 256) | Specify the maximum the number of characters written for cells containing text. Strings in cells which are longer the max, will be truncated. |
Examples
The command:
rvector1.export myrvector
exports data in RVECTOR1 to a CSV file named “myrvector.CSV” in the default directory.
rvector1.export(h,t=csv, n="NaN") myrvector
saves the contents of RVECTOR1 along with the column and row headers to a CSV (comma separated value) file named “myrvector.CSV” and writes all NA values as “NaN”.
rvector1.export(h,t=html, s=50) myrvector
writes the data of RVECTOR1 along with the column and row headers to a HTML file named “myrvector.HTM” at half of the original size.
rvector1.export(n=".", r=B) myrvector
exports the data in the second column to a CSV file named “myrvector.CSV”, and writes all NA values as “.”.
rvector1.export(t=excelxml, cellfmt=clear, mode=update) myrvector range=Country!b5
writes the data in RVECTOR1 to the preexisting “myrvector.XLSX” Excel file to the “Country” sheet at cell B5, where all cell formatting is cleared.
Cross-references
Fill a rowvector object with specified values.
Syntax
vector_name.fill(options) n1[, n2, n3 …]
Follow the keyword with a list of values to place in the specified object. Each value should be separated by a comma.
Running out of values before the object is completely filled is not an error; the remaining cells or observations will be unaffected, unless the “l” option is specified. If, however, you list more values than the object can hold, EViews will not modify any observations and will return an error message.
Options
l | Loop repeatedly over the list of values as many times as it takes to fill the object. |
o=integer (default=1) | Fill the object from the specified element. Default is the first element. |
Examples
The following example declares a four element rowvector MC, initially filled with zeros. The second line fills MC with the specified values and the third line replaces from column 3 to the last column with –1.
rowvector(4) mc
mc.fill 0.1, 0.2, 0.5, 0.5
mc.fill(o=3,l) -1
Cross-references
See
“Matrix Language” for a detailed discussion of rowvector and matrix manipulation in EViews.
Compute frequency tables.
The freq command performs a one-way frequency tabulation.
Frequencies are computed for all of the elements in the rowvector. Missing values are dropped unless included by option. You may use options to control automatic binning (grouping) of values and the order of the entries of the table.
Syntax
rowvector_name.freq(options)
Options
dropna (default) / keepna | [Drop/Keep] NA as a category. |
v=integer (default=1000) | Make bins if the number of distinct values or categories exceeds the specified number. |
nov | Do not make bins on the basis of number of distinct values; ignored if you set “v=integer.” |
a=number | (optional) Make bins if average count per distinct value is less than the specified number. |
b=integer (default=50) | Maximum number of categories to bin into if performing automatic binning. |
n, obs, count (default) | Display frequency counts. |
nocount | Do not display frequency counts. |
total (default) / nototal | [Display / Do not display] totals. |
pct (default) / nopct | [Display / Do not display] percent frequencies. |
cum (default) / nocum | (Display/Do not) display cumulative frequency counts/percentages. |
sort=arg (default=“lohi”) | Sort order for entries in the frequency table: high data value to low ("hilo"), low data value to high ("lohi" –default), high frequency to low ("freqhilo"), low frequency to high ("freqlohi"). |
prompt | Force the dialog to appear from within a program. |
p | Print the table. |
Examples
rvec1.freq(nov, noa)
tabulates all values (no binning) of RVEC1, with entries in ascending value order. The table will display counts, percentages, and cumulative frequencies.
rvec1.freq(v=200, b=50, keepna, noa)
tabulates RVEC1 including NAs. The observations will be binned if RVEC1 has more than 200 distinct values; EViews will create at most 50 equal value-width bins. The number of bins may be smaller than 50.
rvec1.freq(sort=freqhilo)
tabulates RVEC1 with the table rows ordered from values with highest frequency to lowest.
Cross-references
See
“One-Way Tabulation” for a discussion of frequency tables.
Histogram and descriptive statistics of a rowvector.
The hist command displays descriptive statistics and a histogram for the data in the rowvector.
Syntax
rowvector_name.hist(options)
Options
Examples
rvec1.hist
Displays the histogram and descriptive statistics of RVEC1.
Cross-references
See
“Histogram and Stats” for a discussion of the descriptive statistics reported in the histogram view.
See
distplot for a more fully-featured and customizable method of constructing histograms and
Rowvector::stats stats for a view with a more extensive set of basic descriptive statistics.
Imports data from a foreign file into the rowvector object.
Syntax
rowvector_name.import([type=]) source_description import_specification
• source_description should contain a description of the file from which the data is to be imported. The specification of the description is usually just the path and file name of the file, however you can also specify more precise information. See
wfopen for more details on the specification of
source_description.
• The optional “type=” option may be used to specify a source type. For the most part, you should not need to specify a “type=” option as EViews will automatically determine the type from the filename. The following table summaries the various source formats and along with the corresponding “type=” keywords:
| |
Excel (through 2003) | “excel” |
Excel 2007 (xml) | “excelxml” |
HTML | “html” |
Text / ASCII | “text” |
• import_specification can be used to provide additional information about the file to be read. The details of import_specification will depend upon the type of file being imported.
Excel Files
The syntax for reading Excel files is:
rowvector_name.import(type=excel[xml]) source_description [table_description] [variables_description]
The following table_description elements may be used when reading Excel data:
• “range = arg”, where arg is a range of cells to read from the Excel workbook, following the standard Excel format [worksheet!][topleft_cell[:bottomright_cell]].
If the worksheet name contains spaces, it should be placed in single quotes. If the worksheet name is omitted, the cell range is assumed to refer to the currently active sheet. If only a top left cell is provided, a bottom right cell will be chosen automatically to cover the range of non-empty cells adjacent to the specified top left cell. If only a sheet name is provided, the first set of non-empty cells in the top left corner of the chosen worksheet will be selected automatically. As an alternative to specifying an explicit range, a name which has been defined inside the excel workbook to refer to a range or cell may be used to specify the cells to read.
• “byrow”, transpose the incoming data. This option allows you to read files where the series are contained in rows (one row per series) rather than columns.
The optional variables_description may be formed using the elements:
• “colhead=int”, number of table rows to be treated as column headers.
• “na="arg1"”, text used to represent observations that are missing from the file. The text should be enclosed on double quotes.
• “scan=[int| all]”, number of rows of the table to scan during automatic format detection (“scan=all” scans the entire file).
• “firstobs=int”, first observation to be imported from the data (default is 1). This option may be used to start reading rows from partway through the table.
• “lastobs = int”, last observation to be read from the data (default is last observation of the file). This option may be used to read only part of the file, which may be useful for testing.
Excel Examples
rowvec_obj.import "c:\data files\data.xls"
loads the active sheet of “Data.XLSX” into the ROWVEC_OBJ rowvector object.
rowvec_obj.import "c:\data files\data.xls" range="GDP data"
reads the data contained in the “GDP data” sheet of “Data.XLS” into the ROWVEC_OBJ object.
HTML Files
The syntax for reading HTML pages is:
rowvector_name.import(type=html) source_description [table_description] [variables_description]
The following table_description elements may be used when reading an HTML file or page:
• “table = arg”, where arg specifies which HTML table to read in an HTML file/page containing multiple tables.
When specifying arg, you should remember that tables are named automatically following the pattern “Table01”, “Table02”, “Table03”, etc. If no table name is specified, the largest table found in the file will be chosen by default. Note that the table numbering may include trivial tables that are part of the HTML content of the file, but would not normally be considered as data tables by a person viewing the page.
• “skip = int”, where int is the number of rows to discard from the top of the HTML table.
• “byrow”, transpose the incoming data. This option allows you to import files where the series are contained in rows (one row per series) rather than columns.
The optional variables_description may be formed using the elements:
• “colhead=int”, number of table rows to be treated as column headers.
• “na="arg1"”, text used to represent observations that are missing from the file. The text should be enclosed on double quotes.
• “scan=[int|all]”, number of rows of the table to scan during automatic format detection (“scan=all” scans the entire file).
• “firstobs=int”, first observation to be imported from the table of data (default is 1). This option may be used to start reading rows from partway through the table.
• “lastobs = int”, last observation to be read from the table of data (default is last observation of the file). This option may be used to read only part of the file, which may be useful for testing.
HTML Examples
rvec.import "c:\data.html"
loads into the RVEC object the data located in the HTML file “Data.HTML” located on the C:\ drive
rvec.import(type=html) "http://www.tradingroom.com.au/apps/mkt/forex.ac" colhead=3
loads into a rowvector RVEC the data with the given URL located on the website site “http://www.tradingroom.com.au”. The column header is set to three rows.
Text and Binary Files
The syntax for reading text or binary files is:
rowvector_name.import(type=arg) source_description [table_description] [variables_description]
If a table_description is not provided, EViews will attempt to read the file as a free-format text file. The following table_description elements may be used when reading a text or binary file:
• “ftype = [ascii|binary]” specifies whether numbers and dates in the file are stored in a human readable text (ASCII), or machine readable (Binary) form.
• “rectype = [crlf|fixed|streamed]” describes the record structure of the file:
“crlf”, each row in the output table is formed using a fixed number of lines from the file (where lines are separated by carriage return/line feed sequences). This is the default setting.
“fixed”, each row in the output table is formed using a fixed number of characters from the file (specified in “reclen= arg”). This setting is typically used for files that contain no line breaks.
“streamed”, each row in the output table is formed by reading a fixed number of fields, skipping across lines if necessary. This option is typically used for files that contain line breaks, but where the line breaks are not relevant to how rows from the data should be formed.
• “reclines =int”, number of lines to use in forming each row when “rectype=crlf” (default is 1).
• “reclen=int”, number of bytes to use in forming each row when “rectype=fixed”.
• “recfields=int”, number of fields to use in forming each row when “rectype=streamed”.
• “skip=int”, number of lines (if rectype is “crlf”) or bytes (if rectype is not “crlf”) to discard from the top of the file.
• “comment=string“, where string is a double-quoted string, specifies one or more characters to treat as a comment indicator. When a comment indicator is found, everything on the line to the right of where the comment indicator starts is ignored.
• “emptylines=[keep|drop]”, specifies whether empty lines should be ignored (“drop”), or treated as valid lines (“keep”) containing missing values. The default is to ignore empty lines.
• “tabwidth=int”, specifies the number of characters between tab stops when tabs are being replaced by spaces (default=8). Note that tabs are automatically replaced by spaces whenever they are not being treated as a field delimiter.
• “fieldtype=[delim|fixed|streamed|undivided]”, specifies the structure of fields within a record:
“Delim”, fields are separated by one or more delimiter characters
“Fixed”, each field is a fixed number of characters
“Streamed”, fields are read from left to right, with each field starting immediately after the previous field ends.
“Undivided”, read entire record as a single series.
• “quotes=[single|double|both|none]”, specifies the character used for quoting fields, where “single” is the apostrophe, “double” is the double quote character, and “both” means that either single or double quotes are allowed (default is “both”). Characters contained within quotes are never treated as delimiters.
• “singlequote“, same as “quotes = single”.
• “delim=[comma|tab|space|dblspace|white|dblwhite]”, specifies the character(s) to treat as a delimiter. “White” means that either a tab or a space is a valid delimiter. You may also use the abbreviation “d=” in place of “delim=”.
• “custom="arg1"”, specifies custom delimiter characters in the double quoted string. Use the character “t” for tab, “s” for space and “a” for any character.
• “mult=[on|off]”, to treat multiple delimiters as one. Default value is “on” if “delim” is “space”, “dblspace”, “white”, or “dblwhite”, and “off” otherwise.
• “endian = [big|little]”, selects the endianness of numeric fields contained in binary files.
• “string = [nullterm|nullpad|spacepad]”, specifies how strings are stored in binary files. If “nullterm”, strings shorter than the field width are terminated with a single zero character. If “nullpad”, strings shorter than the field width are followed by extra zero characters up to the field width. If “spacepad”, strings shorter than the field width are followed by extra space characters up to the field width.
• “byrow”, transpose the incoming data. This option allows you to import files where the series are contained in rows (one row per series) rather than columns.
• “lastcol”, include implied last column. For lines that end with a delimiter, this option adds an additional column.
When importing a CSV file, lines which have the delimiter as the last character (for example: ‘name,description,date,’), EViews normally determines the line to have 3 columns. With the above option, EViews will determine the line to have 4 columns. Note this is not the same as a line containing ‘name,description,date’. In this case, EViews will always determine the line to have 3 columns regardless if the option is set.
A central component of the table_description element is the format statement. You may specify the data format using the following table descriptors:
• Fortran Format:
fformat=([n1]Type[Width][.Precision], [n2]Type[Width][.Precision], ...)
where Type specifies the underlying data type, and may be one of the following,
I - integer
F - fixed precision
E - scientific
A - alphanumeric
X - skip
and n1, n2, ... are the number of times to read using the descriptor (default=1). More complicated Fortran compatible variations on this format are possible.
• Column Range Format:
rformat="[n1]Type[Width][.Precision], [n2]Type[Width][.Precision], ...)"
where optional type is “$” for string or “#” for number, and n1, n2, n3, n4, etc. are the range of columns containing the data.
• C printf/scanf Format:
cformat="fmt"
where fmt follows standard C language (printf/scanf) format rules.
The optional variables_description may be formed using the elements:
• “colhead=int”, number of table rows to be treated as column headers.
• “na="arg1"”, text used to represent observations that are missing from the file. The text should be enclosed on double quotes.
• “scan=[int|all]”, number of rows of the table to scan during automatic format detection (“scan=all” scans the entire file).
• “firstobs=int”, first observation to be imported from the table of data (default is 1). This option may be used to start reading rows from partway through the table.
• “lastobs = int”, last observation to be read from the table of data (default is last observation of the file). This option may be used to read only part of the file, which may be useful for testing.
Text and Binary File Examples (.txt, .csv, etc.)
rvec2.import c:\data.csv skip=5
reads “Data.CSV” into a RVEC2, skipping the first 5 rows.
rvec2.import(type=text) c:\date.txt delim=comma
loads the comma delimited data “Date.TXT” into the RVEC2 rowvector object.
Cross-references
Display or change the label view of a rowvector object, including the last modified date and display name (if any).
As a procedure, label changes the fields in the rowvector label.
Syntax
vector_name.label
vector_name.label(options) [text]
Options
The first version of the command displays the label view of the rowvector. 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 rowvector RV1 with “Data from CPS 1988 March File”:
rv1.label(r)
rv1.label(r) Data from CPS 1988 March File
To append additional remarks to RV1, and then to print the label view:
rv1.label(r) Log of hourly wage
rv1.label(p)
To clear and then set the units field, use:
rv1.label(u) Millions of bushels
Cross-references
See
“Labeling Objects” for a discussion of labels.
Push updates to OLE linked objects in open applications.
Syntax
vector_name.olepush
Cross-references
See
“Object Linking and Embedding (OLE)” for a discussion of using OLE with EViews.
Import data from a foreign disk file into a rowvector.
(This is a deprecated method of importing into a rowvector. See
Rowvector::import for the currently supported method.)
May be used to import data into an existing workfile from a text, Excel, or Lotus file on disk.
Syntax
vector_name.read(options) [path\]file_name
You must supply the name of the source file. If you do not include the optional path specification, EViews will look for the file in the default directory. Path specifications may point to local or network drives. If the path specification contains a space, you may enclose the entire expression in double quotation marks.
Options
prompt | Force the dialog to appear from within a program. |
File type options
t=dat, txt | ASCII (plain text) files. |
t=wk1, wk3 | Lotus spreadsheet files. |
t=xls | Excel spreadsheet files. |
If you do not specify the “t” option, EViews uses the file name extension to determine the file type. If you specify the “t” option, the file name extension will not be used to determine the file type.
Options for ASCII text files
na=text | Specify text for NAs. Default is “NA”. |
d=t | Treat tab as delimiter (note: you may specify multiple delimiter options). The default is “d=c” only. |
d=c | Treat comma as delimiter. |
d=s | Treat space as delimiter. |
d=a | Treat alpha numeric characters as delimiter. |
custom = symbol | Specify symbol/character to treat as delimiter. |
mult | Treat multiple delimiters as one. |
rect (default) / norect | [Treat / Do not treat] file layout as rectangular. |
skipcol = integer | Number of columns to skip. Must be used with the “rect” option. |
skiprow = integer | Number of rows to skip. Must be used with the “rect” option. |
comment= symbol | Specify character/symbol to treat as comment sign. Everything to the right of the comment sign is ignored. Must be used with the “rect” option. |
singlequote | Strings are in single quotes, not double quotes. |
dropstrings | Do not treat strings as NA; simply drop them. |
negparen | Treat numbers in parentheses as negative numbers. |
allowcomma | Allow commas in numbers (note that using commas as a delimiter takes precedence over this option). |
Options for spreadsheet (Lotus, Excel) files
letter_number (default=“b2”) | Coordinate of the upper-left cell containing data. |
s=sheet_name | Sheet name for Excel 5–8 Workbooks. |
Examples
rv1.read(t=dat,na=.) a:\mydat.raw
reads data into rowvector RV1 from an ASCII file MYDAT.RAW in the A: drive. The data in the file are listed by row, and the missing value NA is coded as a “.” (dot or period).
rv1.read(a2,s=sheet3) cps88.xls
reads data into rowvector RV1 from an Excel file CPS88 in the default directory. The upper left data cell is A2, and the data is read from a sheet named SHEET3.
rv2.read(a2, s=sheet2) "\\network\dr 1\cps91.xls"
reads the Excel file CPS91 into rowvector RV1 from the network drive specified in the path.
Cross-references
See
“Importing Data” for a discussion and examples of importing data from external files.
Resize the rowvector object.
Syntax
rowvector_name.resize rows
Examples
rvec1.resize 20
resizes the rowvector RVEC1 to 20 columns, retaining the contents of any existing elements and initializing new elements to 0.
Cross-references
Declare a rowvector object.
The rowvector command declares and optionally initializes a rowvector object.
Syntax
rowvector(n1) rowvector_name
rowvector rowvector_name=assignment
You may optionally specify the size (number of columns) of the rowvector in parentheses after the rowvector keyword. If you do not specify the size, EViews creates a rowvector of size 1, unless the declaration is combined with an assignment.
By default, all elements of the rowvector are set to 0, unless an assignment statement is provided. EViews will automatically resize new rowvectors, if appropriate.
Examples
rowvector rvec1
rowvector(20) coefvec = 2
rowvector newcoef = coefvec
RVEC1 is a rowvector of size one with value 0. COEFVEC is a rowvector of size 20 with all elements equal to 2. NEWCOEF is also a rowvector of size 20 with all elements equal to the same values as COEFVEC.
Cross-references
Set the object attribute.
Syntax
rowvector_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
Set the column labels in a rowvector object.
Syntax
rowvector_name.setcollabels label1 label2 label3....
Follow the setcollabels command with a space delimited list of column labels. Note that each column label should not contain spaces unless it is enclosed in quotes. If you provide fewer labels than there are columns, EViews will keep the corresponding default column names (“C11”, “C12”, etc...).
Examples
rvec1.setcollabels USA UK FRANCE
sets the column label for the first column in rowvector MAT1 to USA, the second to UK, and the third to FRANCE.
Cross-references
Set the display format for cells in a rowvector object spreadsheet view.
Syntax
vector_name.setformat format_arg
where format_arg is a set of arguments used to specify format settings. If necessary, you should enclose the format_arg in double quotes.
For rowvectors, setformat operates on all of the cells in the rowvector.
To format numeric values, you should use one of the following format specifications:
g[.precision] | significant digits |
f[.precision] | fixed decimal places |
c[.precision] | fixed characters |
e[.precision] | scientific/float |
p[.precision] | percentage |
r[.precision] | fraction |
To specify a format that groups digits into thousands using a comma separator, place a “t” after the format character. For example, to obtain a fixed number of decimal places with commas used to separate thousands, use “ft[.precision]”.
To use the period character to separate thousands and commas to denote decimal places, use “..” (two periods) when specifying the precision. For example, to obtain a fixed number of characters with a period used to separate thousands, use “ct[..precision]”.
If you wish to display negative numbers surrounded by parentheses (i.e., display the number -37.2 as “(37.2)”), you should enclose the format string in “()” (e.g., “f(.8)”).
Examples
To set the format for all cells in the rowvector to fixed 5-digit precision, simply provide the format specification:
rv1.setformat f.5
Other format specifications include:
rv1.setformat f(.7)
rv1.setformat e.5
Cross-references
See
Rowvector::setwidth,
Rowvector::setindent and
Rowvector::setjust for details on setting spreadsheet widths, indentation and justification.
Set the display indentation for cells in a rowvector object spreadsheet view.
Syntax
vector_name.setindent indent_arg
where indent_arg is an indent value specified in 1/5 of a width unit. The width unit is computed from representative characters in the default font for the current spreadsheet (the EViews spreadsheet default font at the time the spreadsheet was created), and corresponds roughly to a single character. Indentation is only relevant for non-center justified cells.
The default indentation setttings are taken from the Global Defaults for spreadsheet views (
“Spreadsheet Data Display”) at the time the spreadsheet was created.
For rowvectors, setindent operates on all of the cells in the rowvector.
Examples
To set the indentation for all the cells in a rowvector object:
rv1.setindent 2
Cross-references
See
Rowvector::setwidth and
Rowvector::setjust for details on setting spreadsheet widths and justification.
Set the horizontal justification for all cells in the spreadsheet view of the rowvector object.
Syntax
rowvector_name.setjust format_arg
where
format_arg may be set to left, center, right, or auto (strings are left-justified and numbers are right-justified). Default display settings can be set in General Options; see
“Spreadsheet Data Display”.
Examples
row1.setjust left
left-justifies the cells in the spreadsheet view of the rowvector ROW1.
Cross-references
See
Rowvector::setwidth and
Rowvector::setindent for details on setting spreadsheet widths and indentation.
Set the row label in a rowvector object.
Syntax
vector_name.setrowlabels label
Follow the setrowlabels command with a row label. Note that the row label should not contain spaces unless it is enclosed in quotes.
Examples
rv1.setrowlabels USA
sets the row label to “USA”.
Cross-references
Set the column width for all columns in a rowvector object spreadsheet.
Syntax
vector_name.setwidth width_arg
where width_arg specifies the width unit value. The width unit is computed from representative characters in the default font for the current spreadsheet (the EViews spreadsheet default font at the time the spreadsheet was created), and corresponds roughly to a single character. width_arg values may be non-integer values with resolution up to 1/10 of a width unit.
Examples
rv1.setwidth 12
sets the width of all columns in rowvector RV1 to 12 width units.
Cross-references
See
Rowvector::setindent and
Rowvector::setjust for details on setting spreadsheet indentation and justification.
Spreadsheet view of a rowvector object.
Syntax
vector_name.sheet(options)
Options
p | Print the spreadsheet view. |
Examples
rv1.sheet(p)
displays and prints the spreadsheet view of rowvector RV1.
Displays the custom row and column labels of a rowvector spreadsheet.
Syntax
rowvector_name.showlabels mode
where mode is either 0 or 1 where 0 displays the default row and column labels and 1 displays the custom row and column labels (if present).
Examples
r1.showlabels 1
displays the custom row and column labels for the R1 spreadsheet. If custom labels have not been set the default labels will be displayed.
r1.showlabels 0
displays the default row and column labels for the R1 spreadsheet.
Cross-references
Descriptive statistics.
Computes and displays a table of means, medians, maximum and minimum values, standard deviations, and other descriptive statistics for a rowvector.
The stats command computes the statistics for each column. Note that in the case of a rowvector, this will be for a single observation.
Syntax
vector_name.stats(options)
Options
Examples
rv1.stats
displays the descriptive statistics view of rowvector RV1.
Cross-references
See
“Descriptive Statistics & Tests” and
(here) for a discussion of the descriptive statistics views of series and groups.
Test simple hypotheses of whether the mean, median, or variance of the elements of a rowvector are equal to specific values.
Syntax
rowvector_name.teststat(options)
Specify the type of test and the value under the null hypothesis as an option. You must specify at least one hypothesis.
For tests of means, you may either estimate the variance or specify the variance as an option.
Options
mean=number | Test the null hypothesis that the mean equals the specified number. |
med=number | Test the null hypothesis that the median equals the specified number. |
var=number | Test the null hypothesis that the variance equals the specified number. The number must be positive. |
std=number | Test equality of mean conditional on the specified standard deviation. The standard deviation must be positive. |
prompt | Force the dialog to appear from within a program. |
p | Print the test results. |
Examples
rvec1.teststat(mean=7)
tests the null hypothesis that the mean of RVEC1 is equal to 7, using an estimated standard deviation.
rvec1.teststat(mean=7, std=2)
tests the null that the mean is 7, using an estimated standard deviation, and also assuming that the standard deviation is known to be 2.
rvec1.teststat(var=4)
tests the null hypothesis that the variance of RVEC1 is equal to 4.
Cross-references
See
“Descriptive Statistics & Tests” for a discussion of simple hypothesis tests.
Write EViews data to a text (ASCII), Excel, or Lotus file on disk.
Creates a foreign format disk file containing EViews data. May be used to export EViews data to another program.
This routine should realistically only be used in the oft-hand chance that you wish to write into a Lotus file. Improved Excel, text, and other format writing is available in
Rowvector::export.
Syntax
vector_name.write(options) [path\filename]
Follow the name of the rowvector object by a period, the keyword, and the name for the output file. The optional path name may be on the local machine, or may point to a network drive. If the path name contains spaces, enclose the entire expression in double quotation marks. The entire rowvector will be exported.
Note that EViews cannot, at present, write into an existing file. The file that you select will, if it exists, be replaced.
Options
prompt | Force the dialog to appear from within a program. |
File type
t=dat, txt | ASCII (plain text) files. |
t=wk1, wk3 | Lotus spreadsheet files. |
t=xls | Excel spreadsheet files. |
If you omit the “t=” option, EViews will determine the type based on the file extension. Unrecognized extensions will be treated as ASCII files. For Lotus and Excel spreadsheet files specified without the “t=” option, EViews will automatically append the appropriate extension if it is not otherwise specified.
ASCII text files
na=string | Specify text string for NAs. Default is “NA”. |
d=arg | Specify delimiter (default is tab): “s” (space), “c” (comma). |
Spreadsheet (Lotus, Excel) files
letter_number | Coordinate of the upper-left cell containing data. |
Examples
rv1.write(t=txt,na=.) a:\dat1.csv
writes the rowvector RV1 into an ASCII file named DAT1.CSV on the A: drive. NAs are coded as “.” (dot).
rv1.write(t=txt,na=.) dat1.csv
writes the same file in the default directory.
rv1.write(t=xls) "\\network\drive a\results"
saves the contents of RV1 in an Excel file “Results.xls” in the specified directory.
Cross-references
Descriptive statistics.
Computes and displays a table of means, medians, maximum and minimum values, standard deviations, and other descriptive statistics for the data in the rowvector.
Syntax
rowvector_name.stats(options)
Options
Examples
rvec1.stats
displays the descriptive statistics view of the elements of the rowvector RVEC1.
Cross-references