Command Reference : Command Reference
  
 
read
Import data from a foreign disk file into series.
May be used to import data into an existing workfile from a text, Excel, or Lotus file on disk.
Unless you need to merge data into an existing workfile page, we recommend that you use the more powerful, easy-to-use tools for reading data (see “Creating a Workfile by Reading from a Foreign Data Source”).
See pageload, and wfopen for command details.
Syntax
read(options) [path\]file_name name1 [name2 name3 ...]
read(options) [path\]file_name n
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.
The input specification follows the source file name. There are two ways to specify the input series. First, you may list the names of the series in the order they appear in the file. Second, if the data file contains a header line for the series names, you may specify the number, n, of series in the file instead of a list of names. EViews will name the n series using the names given in the header line. If you specify a number and the data file does not contain a header line, EViews will name the series as SER01, SER02, SER03, and so on.
To import data into alpha series, you must specify the names of your series, and should enter the tag “$” following the series name (e.g., “NAME $ INCOME CONSUMP”).
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
 
t
Read data organized by series. Default is to read by observation with series in columns.
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.
name
Series names provided in file.
label=integer
Number of lines between the header line and the data. Must be used with the “name” option.
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).
currency= symbol
Specify symbol/character for currency data.
Options for spreadsheet (Lotus, Excel) files
 
t
Read data organized by series. Default is to read by observation with series in columns.
letter_number (default=“b2”)
Coordinate of the upper-left cell containing data.
s=sheet_name
Sheet name for Excel 5–8 Workbooks.
Examples
read(t=dat,na=.) a:\mydat.raw id lwage hrs
reads data from an ASCII file MYDAT.RAW in the A: drive. The data in the file are listed by observation, the missing value NA is coded as a “.” (dot or period), and there are three series, which are to be named ID, LWAGE, HRS (from left to right).
read(a2,s=sheet3) cps88.xls 10
reads data from an Excel file CPS88 in the default directory. The data are organized by observation, the upper left data cell is A2, and 10 series are read from a sheet named SHEET3 using names provided in the file.
read(a2, s=sheet2) "\\network\dr 1\cps91.xls" 10
reads the Excel file CPS91 from the network drive specified in the path.
Cross-references
See “Importing Data” for a discussion and examples of importing data from external files.
See also write.