Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Label range


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Label range
Date   Fri, 2 May 2008 18:24:06 +0100

If you just want the extremes, -summarize, meanonly- is more efficient. 

r(min) and r(max) are accessible in the same way. 

This illustrates a few things you can do: 

* Statalist 2 May 2008 
program labelrange
	version 8 
	syntax varname(numeric) [if] [in] 
	marksample touse 
	qui count if `touse' 
	if r(N) == 0 error 2000 

	su `varlist' if `touse', meanonly 
	di 
	di as text "min: " as res "`: label (`varlist') `r(min)''"
	di as text "max: " as res "`: label (`varlist') `r(max)''" 
end

Nick 
n.j.cox@durham.ac.uk 

Maarten buis

sum origin
di r(min)
di r(max)

Friedrich Huebler 

> -labelbook- lists the range of values, as in the example below. How
> can one access this range for subsequent processing?
> 
> Friedrich
> 
> 
> . sysuse auto
> . labelbook origin
> 
>
------------------------------------------------------------------------
------------
> value label origin
>
------------------------------------------------------------------------
------------
> 
>       values                                    labels
>        range:  [0,1]                     string length:  [7,8]
>            N:  2                 unique at full length:  yes
>         gaps:  no                  unique at length 12:  yes
>   missing .*:  0                           null string:  no
>                                leading/trailing blanks:  no
>                                     numeric -> numeric:  no
>   definition
>            0   Domestic
>            1   Foreign
> 
>    variables:  foreign
> 
>                                     numeric -> numeric:  no
>   definition
>            0   Domestic
>            1   Foreign
> 
>    variables:  foreign
> *

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



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