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: RE: reading value labels -- second and third largest values
From
Jakob Pohlisch <[email protected]>
To
[email protected]
Subject
Re: st: RE: reading value labels -- second and third largest values
Date
Wed, 05 Dec 2012 00:18:33 +0100
David,
such simple solution! A bit smarter every day ;-)
Thank you so much!
Jakob
Am 04.12.12 23:59, schrieb David Radwin:
Jakob,
For question 2, you want to use the extended macro function for the value
label, which is easier to show than to describe:
sysuse nlsw88
codebook race
levelsof race, local(levels)
foreach x of local levels {
display as result "The value for race `x' is `: label (race)
`x''."
}
The help topic can be found at
. help extended_fcn
David
--
David Radwin
Senior Research Associate
MPR Associates, Inc.
2150 Shattuck Ave., Suite 800
Berkeley, CA 94704
Phone: 510-849-4942
Fax: 510-849-0794
www.mprinc.com
-----Original Message-----
From: [email protected] [mailto:owner-
[email protected]] On Behalf Of Jakob Pohlisch
Sent: Tuesday, December 04, 2012 2:30 PM
To: [email protected]
Subject: st: reading value labels -- second and third largest values
Hello List,
i have some short questions concerning user written ado-Files. Iam
writing my own little program here and this list has been an awesome
help for me so far. Thanks to everyone involved!
But now i finally have some problems which a search in the list can't
solve...or i just cannot find the answer.
1. The command summarize is computing the 4 largest and smallest values.
Unfortunately the command is not storing them for the reason that it is
a build in command i cannot manipulate it to do so. To get this values
from a dataset is not that hard. i would just sort the values and take
the values of the observations _N, _N-1 and so on. But if i would like
to use the bysort "command" i would have to get the values of
"subsamples" of my datatset. This is not to hard if i use the preserve
and restore commands. But these commands unfortunately are VERY
time-consuming. I have really big datasets on hand and would like to
obtain those values without the preserve and restore commands. Any idea?
2. I managed to get the levels of a variable with "levelsof `var',
local(levels)". Now i would like to obtain the value labels of those
values if they exist. This will help me displaying my results.
Thank you so much in advance and sorry for all the text and my bad
writing ;-)
Jakob
*
* 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/