Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: FW: producing value labels when value has decimal point


From   Eric Booth <ebooth@ppri.tamu.edu>
To   "<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: FW: producing value labels when value has decimal point
Date   Wed, 11 Aug 2010 20:27:23 +0000

<>

You could just multiply your se_code* values by 10 to get integers --  e.g.

**********************!
clear
inp  se_code1 se_code2
1.1  5.1
1.2  6.1
2.2  6.2
11  1.1
10  11
end

ds se_code*

foreach v in `r(varlist)'  {
cap replace `v' = `v'*10
}

# delimit ;
lab def se_code1 
11 "Nausea and vomiting" 
12"Diarrhea" 
21"Hepatitis"
22 "Transaninase increase"
31 "Renal insufficiency"
41 "Hypothyroidism"
51 "Hypokalemia"
61 "Arthralgia"
62 "Myalgia"
71 "Anaphylaxis"
72 "Pruritis"
73 "Rash"
81 "Tinnitus"
82 "Ototoxicity"
91 "Depression"
92 "Psychosis"
101 "Peripheral neuropathy"
102 "Seizure"
110 "Hypotonia"
;
	# delimit cr
lab li

** note that you can use a -foreach- loop to label your values**

ds  se_code*
foreach v in `r(varlist)' {
	lab val `v'  se_code1
	}
	
**********************!

~ Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu
Office: +979.845.6754


On Aug 11, 2010, at 3:12 PM, Miller, Ann C. wrote:

> 
> # delimit ;
> 
> lab def se_code1 
> 1.1 "Nausea and vomiting" 
> 1.2"Diarrhea" 
> 2.1"Hepatitis"
> 2.2 "Transaninase increase"
> 3.1 "Renal insufficiency"
> 4.1 "Hypothyroidism"
> 5.1 "Hypokalemia"
> 6.1 "Arthralgia"
> 6.2 "Myalgia"
> 7.1 "Anaphylaxis"
> 7.2 "Pruritis"
> 7.3 "Rash"
> 8.1 "Tinnitus"
> 8.2 "Ototoxicity"
> 9.1 "Depression"
> 9.2 "Psychosis"
> 10.1 "Peripheral neuropathy"
> 10.2 "Seizure"
> 11 "Hypotonia"
> ;
> 
> lab val se_code1 se_code1;
> lab val se_code2 se_code1;
> lab val se_code3 se_code1;
> lab val se_code4 se_code1;
> lab val se_code5 se_code1;
> lab val se_code6 se_code1;
> lab val se_code7 se_code1;
> lab val se_code8 se_code1;
> lab val se_code9 se_code1;
> lab val se_code10 se_code1;
> 
> # delimit cr



*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index