Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Question on Removing Superfluous Data

From   Jacob Cheadle <>
Subject   st: RE: Question on Removing Superfluous Data
Date   Thu, 20 Oct 2005 09:29:10 -0400 (EDT)

Adrian Yung Hwei Ow writes:

> I'm new to the list, and I had a short question about STATA commands.
> I'm working for a professor who's trying to clean up her dataset; she
> told me that there was a command in STATA that automatically kept only
> the data columns used to produce result (more precisely, a command
> that allows one to automatically drop columns not used for a given do
> file) -- do you know what this might be?

Besides using 'keep' and 'drop', one can also use

   use var1 ... varN using filename.dta

to read only a subset of the data [columns]. This is useful in situations
where filename.dta is large and/or you already know which variables you
will be using.

It's also worth noting that Stata has very useful 'help' and 'search'
functions.  In your email, you ask for 'automatically kept' variables.
In this case, 'search keep' would have gotten you on the right track by
linking you to the documentation for 'keep' and 'drop'.  Overall, Stata is
rather good at taking keywords and getting you to the command you need.

--Jacob E. Cheadle

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index