<>
Did you attach the -label- to any variable in the upper example? In the
lower one, I can see you did...
Note the difference:
*************
vers 10.1
clear*
set obs 10
gen x=1
la def mylabel 1 Phys 2 Role
la list mylabel
la val x mylabel
ta x
save myfile, replace
u myfile
la list mylabel
*vs:
vers 10.1
clear*
set obs 10
gen x=1
la def mylabel 1 Phys 2 Role
la list mylabel
save myfile, replace
u myfile
la list mylabel
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Jacob Wegelin
Gesendet: Montag, 5. Oktober 2009 22:00
An: [email protected]
Betreff: st: value labels dropped unexpectedly
Sometimes, when I save a dataset in a temporary file and then immediately
reload it, my value label disappears. Can anyone explain why?
This does not always happen; in a toy dataset (below the first example) the
value label is not dropped.
(I am using Stata 10.1.)
.
. label list QOL
QOL:
1 PhysicalFunctioning
2 RolePhysical
3 BodilyPain
4 GeneralHealth
5 Vitality
6 SocialFunctioning
7 RoleEmotional
8 MentalHealth
9 Physical
10 Mental
. tempfile TMPOUT
. save `TMPOUT', replace
(note: file
/var/folders/HR/HRdt7XjbGC4gfgEM2M7yWE+++TM/-Tmp-//S_51906.00004u not found)
file /var/folders/HR/HRdt7XjbGC4gfgEM2M7yWE+++TM/-Tmp-//S_51906.00004u saved
. use `TMPOUT', clear
. des, short
Contains data from
/var/folders/HR/HRdt7XjbGC4gfgEM2M7yWE+++TM/-Tmp-//S_51906.00004u
obs: 366
vars: 215 5 Oct 2009 14:37
size: 455,304 (95.7% of memory free)
Sorted by: Total_Biopsy_Count PID Biopsy
. label list QOL
value label QOL not found
r(111);
.
. clear
.
. input x
x
1. 1
2. 3
3. 1
4. end
.
. label define x 1 "one" 3 "three"
. label values x x
. label list x
x:
1 one
3 three
. tempfile TEMP
. save `TEMP', replace
(note: file
/var/folders/HR/HRdt7XjbGC4gfgEM2M7yWE+++TM/-Tmp-//S_51906.00004w
not found)
file /var/folders/HR/HRdt7XjbGC4gfgEM2M7yWE+++TM/-Tmp-//S_51906.00004w saved
. use `TEMP', clear
. label list x
x:
1 one
3 three
.
Thanks for any insight
Jacob A. Wegelin
Assistant Professor
Department of Biostatistics
Virginia Commonwealth University
730 East Broad Street Room 3006
P. O. Box 980032
Richmond VA 23298-0032
U.S.A.
E-mail: [email protected]
URL: http://www.people.vcu.edu/~jwegelin
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/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/statalist/faq
* http://www.ats.ucla.edu/stat/stata/