[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: improvement |

Date |
Tue, 10 Feb 2004 13:20:36 -0000 |

As indicated in replies to similar questions on 6 November and 12 December, there is no need to loop. Create a variable with your classes and then use the tabulation command of your choice. Edwin Leuven recommended -autocode()-. Another possibility is to use -floor()-. For example: gen lower = 0.05 * floor(pos/0.05) bysort lower : gen count = _N tabdisp lower, cell(count) to display midpoints as here gen midpoint = lower + 0.025 tabdisp midpoint, cell(count) Nick n.j.cox@durham.ac.uk Andreas Aschbacher > we consider small (not infinitesimal) dosis-intervals and the > number of persons who are exposed > to these intervals - the following little program shows how > to count the number of persons in certain intervals : > > /pos is ln(dosis-value) because then it seems to be Gauß-distribution > without logarithmusnaturalis it is lognormal distribution - > it is easier to reach convergence with Gauß-formula in > most cases / > > local i = 3 > while `i' <= 20 { > count if pos >= `i' & pos < `i' + .05 > display > local i = `i' + .05 > } > * 3 - 3.05 -> 3.025 > * 3.05 - 3.1 -> 3.075 > * 3.1 - 3.15 -> 3.125 > * 3.15 - 3.2 -> 3.175 > * 3.2 - 3.25 -> 3.225 > * 3.3 - 3.35 -> 3.325 > > this program counts and you get also zero if there is no > value in interval > - > with these values I can obtain the following ascii-text-file : > > Ascii-Text-file : > x y x...dosis-value in radioactive measurement > y...number of counts > 3.025 1 ->for example : > 3.075 2 ............... two counts in interval 3.05 to 3.1 > 3.125 4 > 3.175 7 > 3.225 6 > 3.275 5 > 3.325 10 > 3.375 13 > 3.425 22 > 3.475 13 > 3.525 24 > 3.575 41 > 3.625 41 > 3.675 60 > 3.725 67 > 3.775 81 > 3.825 98 > 3.875 143 > 3.925 162 > 3.975 181 > 4.025 241 > 4.075 268 > 4.125 301 > ... and so on > > my question : is there a way to get x-column and y-column > simultaneously in a sheet(ascii) during counting ? - > because I start my little counting-program and get the counted values > on results-screen with one blank line after each count > value,then I import > in > excel with copy/paste and add x-column after deleting all blank lines > with a macro. complicated way isn't it ? then I have > ascii-sheet with x-and > y- > column by copy and paste from excel- > each help will be appreciated very much andreas * * 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/

**Follow-Ups**:**Re: st: RE: improvement***From:*"Andreas Aschbacher" <aa_surf@gmx.at>

**st: Reshape***From:*absc11@bangor.ac.uk

- Prev by Date:
**st: constraints for intercepts in mlogit** - Next by Date:
**Re: st: Reshape** - Previous by thread:
**st: constraints for intercepts in mlogit** - Next by thread:
**st: Reshape** - Index(es):

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