Fred,
I think this curiosity has apeared on the list before. It's easy to reproduce:
. sysuse auto
. label dir
origin
. d foreign
storage display value
variable name type format label variable label
-------------------------------------------------------------------------------
foreign byte %8.0g origin Car type
. label drop origin
. label dir
. d foreign
storage display value
variable name type format label variable label
-------------------------------------------------------------------------------
foreign byte %8.0g origin Car type
to get rid of it:
. label values foreign
. des foreign
storage display value
variable name type format label variable label
-------------------------------------------------------------------------------
foreign byte %8.0g Car type
I don't know if this constitutes a feature or a bug. It sort of reminds me of
being in a restaurant, ordering the fish _on the menu_ and then being told the
kitchen has run out of fish.
Phil
Quoting Fred Wolfe <[email protected]>:
> Using Stata 9.2, up to date, I am trying to convert a series of dta files
> to SAS format.
>
> After running for a while my program exits with the following error:
>
> "value label sex not found"
>
> When I examine the data I find the following:
>
>
> . des sex
>
> storage display value
> variable name type format label variable label
> ------------------------------------------------------------------------------
-
> sex byte %12.0g sex Sex
>
> . unlabeled
>
> | Value
> Variable | Label #values unlabeled values
> -----------------+------------------------------------------------------------
----------------------------------------------
> questid | questid 3
> sex | sex 2 0 1
> ethnic1 | ethnic 5
> metcriteria | yesno 2
> pcscard | yesno 0
> edlevel | edlevel 16
> marital | marital 7
> edcat | edcode2 5
>
> . tab sex
>
> Sex | Freq. Percent Cum.
> ------------+-----------------------------------
> 0 | 1,570 77.61 77.61
> 1 | 453 22.39 100.00
> ------------+-----------------------------------
> Total | 2,023 100.00
>
> . label drop sex
> value label sex not found
> r(111);
>
>
> So, -describe- finds the label, but no other program does. Also, I can't
> delete the non-existent label.
>
> I don't know how the label got this way (sorry), for it usually shows:
>
> . ndbuse fixed
> (Survey Fixed Table version of 19 Aug 2006)
>
> . label list sex
> sex:
> 0 Female
> 1 Male
>
>
> My question is this. While it is a small matter to relabel the variable, in
> the program I am running I have >1,000 variables so I would like to fix or
> bypass the problem under program control. Generically, how to I get rid of
> a value label (that doesn't exist) such as this? Is my problem a bug or a
> feature?
>
> Thanks,
>
> Fred
>
> Fred Wolfe
> National Data Bank for Rheumatic Diseases
> Wichita, Kansas
> Tel +1 316 263 2125
> [email protected]
>
>
> *
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
--
Philip Ryan
Associate Professor
Discipline of Public Health
Director, Data Management and Analysis Centre
Associate Dean (IT)
Faculty of Health Sciences
University of Adelaide
5005 South Australia
AUSTRALIA
CRICOS Provider Number 00123M
-----------------------------------------------------------
This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright. If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/