Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: import excel and value labels

From   daniel klein <>
To   "" <>
Subject   Re: st: import excel and value labels
Date   Wed, 11 Dec 2013 10:39:53 +0100

Since you -clear- the memory by specifying the respective option, it
seems natural to me. It is the same as

la de foo 1 "foo"
sysuse auto ,clear
la li foo

However, defined value labels are also cleared if we do not sepcify
the -clear- option.

la de foo 1 "foo"
sysuse auto
la li

This makes me wonder about the "status" of value labels. They
obviously are not regarded as changes to the dataset -- otherwise
there would be therespective error message and return code  r(4) . One
migth argue that there should be a similar error message to remind you
of the fact that you are about to lose your defined value labels - but
cerainly not if you explicitly specified a -clear- option.

See -label save- for a way to preserve the value labels before
importing a dataset.


I noticed that whenever I load an excel file in Stata using -import
excel- the existing values labels are deleted.  Is this the normal
behavior of -import excel-?

Here is an example:

. label define test 1 "yes" 2 "no"

. label l test
           1 yes
           2 no

. import excel book1.xlsx, clear first

. label l test
value label test not found
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index