Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: import excel and value labels
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: import excel and value labels
Date
Wed, 11 Dec 2013 10:47:17 +0000
As Daniel explained, this is standard behaviour.
I see a case for documenting as you ask only if it's done in the same
way for all such -clear- options.
Nick
[email protected]
On 11 December 2013 10:26, A Loumiotis <[email protected]> wrote:
> I would like to add though that perhaps there should be a modification
> in the help file of -import excel, clear- so that it is also stated
> that not only the data but also the value labels are cleared from
> memory before loading the excel file.
>
> On Wed, Dec 11, 2013 at 12:15 PM, A Loumiotis
> <[email protected]> wrote:
>> Thank you Daniel for your explanation. I see now that -import excel,
>> clear- will first clear any existing data and value labels from memory
>> and then load the excel file.
>> Best,
>> Antonis
>>
>>
>> On Wed, Dec 11, 2013 at 11:39 AM, daniel klein
>> <[email protected]> wrote:
>>> Since you -clear- the memory by specifying the respective option, it
>>> seems natural to me. It is the same as
>>>
>>> clear
>>> 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.
>>>
>>> clear
>>> 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.
>>>
>>> Best
>>> Daniel
>>>
>>> --
>>> 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
>>> test:
>>> 1 yes
>>> 2 no
>>>
>>> . import excel book1.xlsx, clear first
>>>
>>> . label l test
>>> value label test not found
>>> r(111);
>>> *
>>> * For searches and help try:
>>> * http://www.stata.com/help.cgi?search
>>> * http://www.stata.com/support/faqs/resources/statalist-faq/
>>> * http://www.ats.ucla.edu/stat/stata/
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/