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

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of 
> Enzo Coviello
> Sent: 18 November 2004 06:04
> To: [email protected]
> 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index