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

RE: st: RE: counting


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: counting
Date   Wed, 29 Sep 2004 15:11:41 +0100

Well, it makes little difference, but nevertheless 
-forval- is faster, shorter and simpler to set up. 
What would it take to persuade you to use it? 

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Andreas
> Aschbacher
> Sent: 29 September 2004 15:08
> To: [email protected]
> Subject: Re: st: RE: counting
> 
> 
> thank you very much,now i use this and it is working ::
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> local i = 1
> while `i' < 10000 {
>         qui count if d0 >= `i' & d0  < `i' + 1
>         display"`i'.5" "{col 8}" r(N) 
>         local i = `i' + 1
> }
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /with forval the same /
> andreas aschbacher
> 
> 
> 
>  You got what you asked for. 
> > 
> > By default -count- shows its result. 
> > 
> > -display- with no arguments shows a blank line. 
> > 
> > Alternatively, suppress the -count- result and do this: 
> > 
> > forval i = 1/10000 { 
> > 	qui count if d0 == `i' 
> > 	di "`i'.5" "{col 8}" r(N)  
> > } 
> > 
> > -outsheet- isn't going to help with this because you 
> > are not putting the results in a variable. A better
> > way to put this in a file is e.g. using -postfile-. 
> > 
> > Nick 
> > [email protected] 
> > 
> > Andreas Aschbacher
> > 
> > > I have d0 as variable-name for one column of my data :
> > > I use the following in a do-file:
> > > 
> > > local i = 1
> > > while `i' < 10000 {
> > >         count if d0 >= `i' & d0  < `i' + 1
> > >         display
> > >         local i = `i' + 1
> > > }
> > >  
> > > -> and I get in my logfile ->
> > >   .....
> > >    22
> > > 
> > >    27
> > > 
> > >    47
> > > 
> > >    67
> > > 
> > >    63
> > > 
> > >    84
> > > 
> > >   116
> > > 
> > >   195
> > > .......  
> > >  ->  always with empty lines between !!!
> > >  ->  but I want to get the following :
> > >   1.5   22
> > >   2.5   27
> > >   3.5   47
> > >   4.5   67
> > >   5.5   63
> > >   6.5   84
> > >   7.5   116
> > >   8.5   195
> > >   ..
> > >   ..
> > >  9999.5 12
> > > : with no emty lines between and in first column numbers 
> > > ascending from 1.5
> > > to 9999.5 with step 1.
> > > please "quick" advice how to bring the two resulting columns 
> > > automatically
> > > in excel-Sheet,for example in first and second column.is this 
> > > possible ?
> > > I was not successful with outsheet.
> > 
> > *
> > *   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/
> > 
> 
> -- 
> +++ GMX DSL Premiumtarife 3 Monate gratis* + WLAN-Router 0,- EUR* +++
> Clevere DSL-Nutzer wechseln jetzt zu GMX: http://www.gmx.net/de/go/dsl
> 
> *
> *   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/
> 

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