Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: intervals of equal width


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: intervals of equal width
Date   Thu, 18 Nov 2004 10:21:13 -0000

I can think of dumb ways to do this. Put 
the numlist in a variable, calculate 
the differences and look at the summary 
statistics using -summarize-. 

Alternatively do it directly. This 
code (1) assumes an ordered numlist, 
minimum first (2) is not tested much. 

tokenize "`numlist'" 
local nn : word count `numlist' 
local max = 0 
local min = . 
forval i = 2/`nn' { 
	local j = `i' - 1 
	local diff = ``i'' - ``j'' 
	local min = min(`diff',`min') 
	local max = max(`diff',`max') 
} 
di "`min' `max'" 

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

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of 
> Enzo Coviello
> Sent: 18 November 2004 06:04
> To: statalist@hsphsun2.harvard.edu
> Subject: st: intervals of equal width
> 
> 
> Dear List friends,
> 
> just a brief question:
> 
> Do you know a clever way to identify whether the intervals 
> (allowing some 
> approximation)  in a numlist are of different width ?
> 
> Many thanks for your solutions.
> 
> Enzo
> 
> ^^^^^^^^^^^^^^^^
> Enzo Coviello
> Dipartimento di Prevenzione ASL BA/1
> via L. Barbera 27 - 70055 MINERVINO MURGE (BA)
> Italy
> tel - fax +39 0883 691053
> tel (home) +39 0883 695055
> mobile 347 5016016 
> 
> *
> *   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/
> 

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