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

st: RE: counting


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: counting
Date   Fri, 12 Dec 2003 18:24:46 -0000

No need to loop. 

gen rounded = 0.05 * floor(x/0.05) 
tab rounded 

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

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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index