Differences between revisions 3 and 5 (spanning 2 versions)
Revision 3 as of 2023-06-08 20:18:29
Size: 437
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:

keep if foo==1

keep in 1/10
Line 21: Line 27:
Note that the variables kept are not re-ordered. See the [[Stata/Order|order]] command for that functionality.



=== Cases ===

{{{
keep if foo==1
keep in 1/10
}}}
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)