help for safedrop

Drop variables if and only if varnames specified in full

safedrop namelist


safedrop drops the variable(s) named in namelist if and only if every element of namelist is a fully spelled out variable name.


Suppose (1) you want to drop variable myvar if and only if that variable exists with exactly that name; (2) there is just one variable in your dataset whose name begins with myvar, namely myvariable. As myvar is an unambiguous abbreviation of myvariable, both drop myvar and capture drop myvar will cause myvariable to be dropped. safedrop myvar is a way to ensure that this does not happen.


. safedrop myvar

. safedrop myvar yourvar


Nicholas J. Cox n.j.cox@durham.ac.uk

Also see