Stata 15 help for outsheet

outsheet has been superseded by import delimited. outsheet 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] outsheet -- Write spreadsheet-style dataset

Syntax

outsheet [varlist] using filename [if] [in] [, options]

options Description ------------------------------------------------------------------------- Main comma output in comma-separated (instead of tab-separated) format delimiter("char") use char as delimiter nonames do not write variable names on the first line nolabel output numeric values (not labels) of labeled variables noquote do not enclose strings in double quotes

replace overwrite existing filename ------------------------------------------------------------------------- If filename is specified without a suffix, .out is assumed. If your filename contains embedded spaces, remember to enclose it in double quotes. replace does not appear in the dialog box.

Menu

File > Export > Comma- or tab-separated data

Description

outsheet, by default, writes data into a file in tab-separated format. outsheet also allows users to specify comma-separated format or any separation character that they prefer. export excel may be a better option if you are exporting data to a program that can read Excel files; see [D] import excel.

Options

+------+ ----+ Main +-------------------------------------------------------------

comma specifies comma-separated format rather than the default tab-separated format.

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

nonames specifies that variables name not be written in the first line of the file; the file is to contain data values only.

nolabel specifies that the numeric values of labeled variables be written into the file rather than the label associated with each value.

noquote specifies that string variables not be enclosed in double quotes.

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

replace specifies that filename be replaced if it already exists.

Examples

Setup . sysuse auto . keep make price mpg rep78 foreign . keep in 1/10

Write date in memory to the file myauto.out in tab-separated text format . outsheet using myauto

Display contents of myauto.out . type myauto.out

Same as above outsheet command, but do not put variable names in the first line of the file and replace the existing myauto.out file . outsheet using myauto, nonames replace

Display contents of myauto.out . type myauto.out

Same as above outsheet command, but do not enclose strings in quotes . outsheet using myauto, nonames noquote replace

Display contents of myauto.out . type myauto.out

Same as above outsheet command, but output numeric values of labeled variables . outsheet using myauto, nonames noquote nolabel replace

Display contents of myauto.out . type myauto.out


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