-------------------------------------------------------------------------------
help for isvar
-------------------------------------------------------------------------------

Filter names into variable names and others

isvar possiblevarlist

Description

isvar takes a list of names that might name variables in your dataset and filters it into a list of those names that are indeed variable names and a list of the others.

One application of isvar arises when you are moving between similar datasets, especially if they are large, but are not sure which variables are defined in which dataset. Commands such as describe would fail at the first name not in fact a variable name. isvar offers a more direct way to establish existence or non-existence of several possible variables.

Saved results

r(varlist) names of variables in current dataset r(badlist) names that do not correspond to variables in current dataset

Examples

. isvar mpg rep78 rep77 . local OKlist "`r(varlist)'" . su `OKlist'

Author

Nicholas J. Cox, Durham University, U.K. n.j.cox@durham.ac.uk

Acknowledgements

This problem was suggested by Amadou Diallo.

Also see

Online: help for describe; unab