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

RE:st: do-it-yourself class intervals [was: X-Priority: 3 (Normal)]


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE:st: do-it-yourself class intervals [was: X-Priority: 3 (Normal)]
Date   Thu, 6 Nov 2003 11:39:47 -0000

One way is to form classes by lower class limits:

. gen to_table = 5.34 + 10 * floor((yourvar - 5.34)/ 10)
. tab to_table

A brief discussion of -floor()- and its sibling -ceil()-
as ways of rounding down and up systematically will
appear in Stata Journal 3(4) 2003. In your case -int()-
would work as well.

Nick
[email protected]

Andreas Aschbacher

> I have one column with 700000 real-values from 25.34 to 344256,75 in
> ascending order.
> I want to create intervalls such as from 25.34 to 35.34 and
> from 35.34 to
> 45.34 and so on
> (equidistant steps) until maximum.then I want to count the
> values in each
> intervall,for
> example:
>                     from 25.34 t0 35.34          27 values
>                     from 35.34 to  45.34         377 values
>         and so
> on
> how to realize this problem ? i tryed with
> table,tabstat,tabulate but I wasn't successful,

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