Object Reference : Object View and Procedure Reference : Matrix
  
 
export
Export matrix to disk as an Excel 2007 XLSX, CSV, tab-delimited ASCII text, RTF, HTML, Enhanced Metafile, LaTeX, PDF, or Markdown file.
Syntax
matrix_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 File Locations global options.
The base syntax for writing Excel 2007 files is:
matrix_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:
matrix1.export mymatrix
exports the data in MATRIX1 to a CSV file named “mymatrix.CSV” in the default directory.
matrix1.export(h, t=csv, n="NaN") mymatrix
saves the contents of MATRIX1 along with the column and row headers to a CSV (comma separated value) file named “mymatrix.CSV” and writes all NA values as “NaN”.
matrix1.export(h, t=html, s=50) mymatrix
exports the data in MATRIX1 along with the column and row headers to a HTML file named “mymatrix.HTM” at half of the original size.
matrix1.export(n=".", r=B) mymatrix
saves the data in the second column to a CSV file named “mymatrix.CSV”, and writes all NA values as “.”.
matrix1.export(t=excelxml, cellfmt=clear, mode=update) mymatrix range=Country!b5
writes the data in MATRIX1 to the preexisting “mymatrix.XLSX” Excel file to the “Country” sheet at cell B5, where all cell formatting is cleared.
Cross-references
See also Matrix::import.