Differences between revisions 2 and 5 (spanning 3 versions)
Revision 2 as of 2023-06-08 01:06:29
Size: 536
Comment:
Revision 5 as of 2025-10-24 17:06:27
Size: 374
Comment: Typo
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
The '''`keep`''' command is used to subset cases or variables. See also the [[Stata/Drop|drop]] command. '''`-keep-`''' subsets cases or variables.

See also [[Stata/Drop|-drop-]].
Line 19: Line 21:
}}}
Line 21: Line 22:
Note that the variables kept are not re-ordered. See the [[Stata/Order|order]] command for that functionality. keep if foo==1
Line 23: Line 24:


=== Cases ===

{{{
keep if foo==1
Line 32: Line 27:
----



== See also ==

[[https://www.stata.com/manuals/dkeep.pdf|Stata manual for keep]]
Note that variables are not re-ordered by `-keep-`. See [[Stata/Order|-order-]] for that functionality.

Stata Keep

-keep- subsets cases or variables.

See also -drop-.


Usage

Variables

keep foo bar baz

keep if foo==1

keep in 1/10

Note that variables are not re-ordered by -keep-. See -order- for that functionality.


CategoryRicottone

Stata/Keep (last edited 2025-10-24 17:06:27 by DominicRicottone)