You are on page 1of 1

Command

keeplabel
Store and restore labels to preserve variable labels when
running commands like collapse that change variable labels
Syntax
keeplabel [varlist ] [, store or load ]
options
Main
store
load

Description
stores the variable labels of the variables in
varlist
loads the variable labels of the variables in
varlist that were stored using the store option

Description
keeplabel stores and restores variable labels for the variables in varlist
so that variable labels may be preserved when running commands that change
variable labels, such as collapse
Options
Main
store stores the variable labels of the variables in varlist in memory.
This is used before a command that changes variable labels so that
load may be called after the command to restore the original labels.
load loads the variable labels of the variables in varlist that were saved
by the store option
Examples
Store and restore a single variable label after collapse
. sysuse auto, clear
. keeplabel make, store
. collapse (first) make, by(mpg)
. keeplabel make, load
Store and restore multiple variable labels after collapse
. sysuse auto, clear
. keeplabel make-price, store
. collapse (first) make-price, by(mpg)
. keeplabel make-price, load
Author
Alex Knight, Leavitt Partners

You might also like