No need to loop.
gen rounded = 0.05 * floor(x/0.05)
tab rounded
Nick
[email protected]
Andreas Aschbacher
> I have the following dataset in ascii in ascending order:
> 1.549688
> 1.551809
> 1.857859
> 2.032088
> 2.055405
> 2.211566
> 2.36462
> 2.36556
> 2.451005
> 2.464704
> 2.562639
> 2.568022
> 2.575661
> ...... / always with 5 or 6 places
> behind comma
> ~500000 values in file /
> /
>
> I'd like to know how many values are between :
> 1.05 and 1.1
> that means >= 1.05
> and < 1.1 stepwidth = 0.05
> I'd like to know how many values are between :
> 1.1 and 1.15
> that means >= 1.1
> and < 1.15 stepwidth = 0.05
> I'd like to know how many values are between :
> 1.15 and 1.2
> that means >= 1.15
> and < 1.2 stepwidth = 0.05
> and so on .........
>
> I can't get good results with already discussed method of
> - tabulate
> myvar,subpop(var2) -
> because I know results from an Excel-Macro.
> My question is: Is there another method of counting ?
> any help will be appreciated very much
*
* 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/