help autorename

Title

autorename -- Rename variables according to a row in the dataset.

Syntax

autorename [varlist , row(#) nodrop
nolower vseparator(string) varlabels]

Description

autorename renames variables according to a specified row in the dataset. This can be useful when reading text files into Stata.
For example, you may need to insheet and manipulate a text file before the variable names are accessible. autorename takes care to make variable names conform to Stata's naming scheme.
For example, it eliminates characters like '*' and '&' before renaming.

Options

row(#) specifies the row number containing the new variable names. The default is
to use the first row.

nodrop instructs Stata not to drop the row of data containing the new variable names.

nolower instructs Stata not to lowercase the renamed variables.

vseparator(string) specifies what string should be used to replace spaces in variable
names (since Stata prohibits spaces in variable names). If vseparator() is not
specified then vseparator("") is assumed (so that words will be concatenated
together).

varlabels labels the variables with their new variable names in addition to renaming them. No characters are parsed out of the variable label.

Example

. sysuse auto.dta, clear

. tempfile t

. outsheet using "`t'", replace

. insheet using "`t'", nonames clear

. autorename

Author

Julian Reif, University of Chicago

jreif@uchicago.edu

Also see

rename