Stata 15 help for insheet

insheet has been superseded by import delimited. insheet continues to work but, as of Stata 13, is no longer an official part of Stata. This is the original help file, which we will no longer update, so some links may no longer work.

Title

[D] insheet -- Read text data created by a spreadsheet

Syntax

insheet [varlist] using filename [, options]

options Description ------------------------------------------------------------------------- [no]double override default storage type tab tab-delimited data comma comma-delimited data delimiter("char") use char as delimiter clear replace data in memory case preserve variable name's case

[no]names variable names are included on the first line of the file ------------------------------------------------------------------------- [no]names does not appear in the dialog box

Menu

File > Import > Text data created by a spreadsheet

Description

insheet reads into memory from a disk a dataset that is not in Stata format. insheet is intended for reading files created by a spreadsheet or database program. Regardless of the creator of the file, insheet reads text (ASCII) files in which there is 1 observation per line and the values are separated by tabs or commas. Also the first line of the file can contain the variable names. If you type

. insheet using filename

insheet reads your data; that is all there is to it.

If filename is specified without an extension, .raw is assumed. If your filename contains embedded spaces, remember to enclose it in double quotes.

Stata has other commands for reading data. If you are not sure that insheet will do what you are looking for, see [D] import and [U] 21 Entering and importing data. If you want to save your data in spreadsheet-style text format, see [D] outsheet. However, export excel may be a better option; see [D] import excel.

Options

[no]double affects the way Stata handles the storage of floating-point variables. If the default storage type (see [D] generate) is set to float, specifying the double option forces Stata to store floating-point variables as doubles rather than floats. If the default storage type has been set to double, you must specify nodouble to have floating-point variables stored as floats rather than doubles; see [D] data types.

tab tells Stata that the values are tab-separated. Specifying this option will speed insheet's processing, assuming that you are right. insheet can determine for itself whether the separation character is a tab or a comma.

comma tells Stata that the values are comma-separated. Specifying this option will speed insheet's processing, assuming that you are right. insheet can determine for itself whether the separation character is a comma or a tab.

delimiter("char") allows you to specify other separation characters. For instance, if values in the file are separated by a semicolon, specify delimiter(";").

clear specifies that it is okay for the new data to replace the data that are currently in memory. To ensure that you do not lose something important, insheet will refuse to read new data if data are already in memory. clear allows insheet to replace the data in memory. You can also drop the data yourself by typing drop _all before reading new data.

case preserves the variable name's case. By default, all variable names are imported as lowercase.

The following option is available with insheet but is not shown in the dialog box:

[no]names informs Stata whether variable names are included on the first line of the file. Specifying this option will speed insheet's processing, assuming that you are right. insheet can determine for itself whether the file includes variable names.

Examples

. insheet using auto.raw

. insheet using auto.raw, clear

. insheet using auto.raw, clear double


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index