Stata Ds

The ds command lists variables.


Usage

Used alone, ds will simply return the given variable list.

ds foo bar baz

To list all variables other than foo, bar, and baz, try the not option:

ds foo bar baz, not

Variables can be described by a specification and ds will return the list of variables matching (or not matching) it.

ds, spec(type numeric)
ds, not(type string)


Specifications

Valid specifications for the spec(spec) and not(spec) options are:

Types are any of the data types plus categories like string, str#, and numeric.

Patterns look like %t* (as in format %t*, which selects all variables with a datetime display format) or *weight* (as in varlabel *weight*, which selects all variables with a variable label including the word 'weight').


Stored Results

The list of selected variables is stored in r(varlist), without any truncation or indentation.


See also

Stata manual for ds


CategoryRicottone

Stata/Ds (last edited 2023-06-08 20:15:28 by DominicRicottone)