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

Re: st: RE: intervals of equal width


From   Enzo Coviello <enzo.coviello@tin.it>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: intervals of equal width
Date   Thu, 18 Nov 2004 15:41:00 +0100

At 10.21 18/11/04 +0000, you wrote:
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'"
Many thanks Prof Cox, particularly for your "direct" advice.
Actually I thought that a simpler solution would be possible.

Anyway it looks effective. I will adopt it.
Thanks again.

Enzo





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