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]
st: RE: Labeling Min and Max Values
From
"Martin Weiss" <[email protected]>
To
<[email protected]>
Subject
st: RE: Labeling Min and Max Values
Date
Fri, 5 Mar 2010 22:32:44 +0100
<>
You might even end up using -list- for this purpose:
*******
clear*
set obs 50
gen byte country=_n
la def coun ///
1 "Afghanistan " ///
2 "Albania " ///
3 "Algeria " ///
4 "Andorra " ///
5 "Angola " ///
6 "Anguilla " ///
7 "Antarctica " ///
8 "Argentina " ///
9 "Armenia " ///
10 "Aruba " ///
11 "Australia " ///
12 "Austria " ///
13 "Azerbaijan " ///
14 "Bahrain " ///
15 "Bangladesh " ///
16 "Barbados " ///
17 "Bassas da India " ///
18 "Belarus " ///
19 "Belgium " ///
20 "Belize " ///
21 "Benin " ///
22 "Bermuda " ///
23 "Bhutan " ///
24 "Bolivia " ///
25 "Bosnia and Herzegovina " ///
26 "Botswana " ///
27 "Bouvet Island " ///
28 "Brazil " ///
29 "British Indian Ocean Territory" ///
30 "British Virgin Islands " ///
31 "Brunei " ///
32 "Bulgaria " ///
33 "Burkina Faso " ///
34 "Burma " ///
35 "Burundi " ///
36 "Cambodia " ///
37 "Cameroon " ///
38 "Canada " ///
39 "Cape Verde " ///
40 "Cayman Islands " ///
41 "Central African Republic " ///
42 "Chad " ///
43 "Chile " ///
44 "China " ///
45 "Christmas Island " ///
46 "Clipperton Island " ///
47 "Cocos " ///
48 "Colombia " ///
49 "Comoros " ///
50 "Cook Islands " ///
la val country coun
expand 5
bys country: gen byte year=_n
gen growth=rnormal(.01,.03)
bys year: egen locmax=max(growth)
by year: egen locmin=min(growth)
bys year (growth): gen byte min=_n==1
by year (growth): gen byte max=_n==_N
la def max 0 "" 1"max"
la def min 0 "" 1 "min"
la val max max
la val min min
replace locmax=. if min
replace locmin=. if max
li year country max min locmax locmin /*
*/ if min | max, sepby(year) noo
*******
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of e. lauren
Sent: Freitag, 5. März 2010 21:15
To: [email protected]
Subject: st: Labeling Min and Max Values
Hi all:
A pretty straightforward question, but how does one label corresponding Min
and Max values (using tabout or another tabulate command).
Let's say I have a list of 50 countries and corresponding GDP growth rates,
over time. I would like to use tabout to label the local minimums and
maximums, and indicate the corresponding country name for each given year.
Any tips on how to set this up?
Many thanks,
Lauren
*
* 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/