= 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: * `type typelist` * `format patternlist` * `varlabel patternlist` * `vallabel patternlist` * `char patternlist` Types are any of the [[Stata/DataTypes|data types]] plus categories like `string`, `str#`, and `numeric`. Patterns look like `%t*` (as in `format %t*`, which selects all variables with a [[Stata/DataFormats#Date_and_Datetime_Data|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 == [[https://www.stata.com/manuals/dds.pdf|Stata manual for ds]] ---- CategoryRicottone