Statalist


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

RE: st: Label range


From   "Nick Cox" <[email protected]>
To   <[email protected]>
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 
[email protected] 

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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index