help valuesof
-------------------------------------------------------------------------------

Title

valuesof -- Return the contents of a variable in r(values)

Syntax

valuesof varname [if] [in] [, options]

options Description ------------------------------------------------------------------------- missing include missing values of varname format(%fmt) specify the format used for numeric values; default is format(%18.0g) -------------------------------------------------------------------------

Description

valuesof displays and returns in r(values) the values of varname joined together in a single string. The values are listed in the current sort order of the dataset and are separated by blanks. Values with embedded spaces or embedded quotes will be returned in double quotes or compound double quotes, as appropriate.

valuesof returns all values of varname. If you are interested in a list of the distinct values, i.e. the "levels" of varname, see levelsof.

Note that valuesof may hit the limits imposed by your Stata (see "# of characters in a macro" in help limits).

Dependencies

valuesof requires the moremata package. Type

. ssc describe moremata

Options

missing specifies that missing values of varname should be included in the returned string. The default is to exclude them.

format(%fmt) specifies the format to be used for numeric values. The default format is %18.0g.

Examples

. sysuse auto, clear

. valuesof rep78 in 1/10

. return list

. valuesof rep78 in 1/10, missing

. valuesof make in 1/10

Author

Ben Jann, ETH Zurich, jann@soz.gess.ethz.ch

Also see

Online: return, macro, levelsof, limits