-------------------------------------------------------------------------------
help for vartyp
-------------------------------------------------------------------------------

Set or list variable types (characteristics) for the codebook2 command

vartyp [varlist] [, set(type) | list(type)] Where "type" id one of: disc - discrete cont - continuous ord - ordinal date - elaspsed date id - identification undef - undefined type clear - clear a set type

Description

The vartyp command is used to set or list the variable type(s) used by the codebook2 command. With no variables or options specified, vartyp will simply list all variables and their types. vartyp can also be used to clear types that have already been set.

Saved Results

Variables listed or set are returned in r(varlist).

Examples

List all variables: . vartyp

List specific variables: . vartyp idnum var1 weight

List variables of a specific type: . vartyp ,l(cont) . vartyp ,l(id)

List variables that have no type set: . vartyp, l(undef)

Set a type for a variable: . vartyp idnum, s(id) . vartyp birthdate weddate, s(date)

Clear a type set for a variable: . vartyp var1, s(clear)

If you simply want to change a variable's type, you only need to set it to the new type, you do not have to clear it first. The vartyp command can work nicely with the ds3 command to set types for many variables at a time:

Set the type to "cont" for all variables that do not have a value label: . ds3, not(vall) . vartyp `r(varlist)', s(cont)

Set the type to "date" for all varaibles with the word "date" in the variable label: . ds3, has(varl "*date*") . vartyp `r(varlist)', s(date)

Now set all the remaining variables to "disc": . vartyp, l(undef) . vartyp `r(varlist)', s(disc)

-------------------------------------------------------------------------------

Author Paul H. Bern, Syracuse University, phbern@syr.edu

See Also: Help for: characteristic Net Search: ds3 Net Search: codebook2