help outsheet dialog: outsheet
-------------------------------------------------------------------------------
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
-------------------------------------------------------------------------
+ replace is not shown in the dialog box.
If filename is specified without a suffix, .out is assumed.
If your filename contains embedded spaces, remember to enclose it in
double quotes.
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.
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 ASCII 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
Also see
Manual: [D] outsheet
Help: [D] insheet, [D] outfile