You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.4 KiB
Plaintext
57 lines
1.4 KiB
Plaintext
8 months ago
|
{smcl}
|
||
|
{* 20sep2005}{...}
|
||
|
{hline}
|
||
|
help for {hi:isvar}
|
||
|
{hline}
|
||
|
|
||
|
{title:Filter names into variable names and others}
|
||
|
|
||
|
{p 8 17 2}
|
||
|
{cmdab:isvar} {it:possiblevarlist}
|
||
|
|
||
|
|
||
|
{title:Description}
|
||
|
|
||
|
{p 4 4 2}
|
||
|
{cmd: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.
|
||
|
|
||
|
{p 4 4 2}
|
||
|
One application of {cmd: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 {help describe} would fail at the
|
||
|
first name not in fact a variable name. {cmd:isvar} offers a more direct way to
|
||
|
establish existence or non-existence of several possible variables.
|
||
|
|
||
|
|
||
|
{title:Saved results}
|
||
|
|
||
|
{p 4 8 2}r(varlist) names of variables in current dataset{p_end}
|
||
|
{p 4 8 2}r(badlist) names that do not correspond to variables in current dataset
|
||
|
|
||
|
|
||
|
{title:Examples}
|
||
|
|
||
|
{p 4 8 2}{cmd:. isvar mpg rep78 rep77}{p_end}
|
||
|
{p 4 8 2}{cmd:. local OKlist "`r(varlist)'"}{p_end}
|
||
|
{p 4 8 2}{cmd:. su `OKlist'}
|
||
|
|
||
|
|
||
|
{title:Author}
|
||
|
|
||
|
{p 4 4 2}Nicholas J. Cox, Durham University, U.K.{break}
|
||
|
n.j.cox@durham.ac.uk
|
||
|
|
||
|
|
||
|
{title:Acknowledgements}
|
||
|
|
||
|
{p 4 4 2}This problem was suggested by Amadou Diallo.
|
||
|
|
||
|
|
||
|
{title:Also see}
|
||
|
|
||
|
{p 4 13 2}
|
||
|
Online: help for {help describe}; {help unab}
|
||
|
|