Assume you have a large dataset which you conduct some analysis of. There might be some variables which are not used in any of the models and from here-on-out (or for sharing purposes) are simply dead-weight.
Naturally one would just drop the unneeded variables (or keep the needed ones). But what if the dataset is very large (hundreds of variables and much more) and/or there are many models with many different variables as well.
Is there any way to "automate" this process? perhaps some command/macro which stores all variables "used" and thus allows the user to "keep" them.
Illustrative example:
where "tokeep" will record price mpg rep78 trunk weight, and thus executing "keep `tokeep'" would keep these variables.
Naturally one would just drop the unneeded variables (or keep the needed ones). But what if the dataset is very large (hundreds of variables and much more) and/or there are many models with many different variables as well.
Is there any way to "automate" this process? perhaps some command/macro which stores all variables "used" and thus allows the user to "keep" them.
Illustrative example:
Code:
sysuse auto tokeep, start reg price mpg rep78 reg trunk weight tokeep, end keep `tokeep'

Comment