Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: forvalues


From   "Justina Fischer" <JAVFischer@gmx.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: forvalues
Date   Tue, 23 Oct 2012 14:37:04 +0200

To me it appears that his name is 'Dimpol' ;-)

Best
Justina
-------- Original-Nachricht --------
> Datum: Tue, 23 Oct 2012 05:32:39 -0700
> Von: William Buchanan <william@williambuchanan.net>
> An: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
> Betreff: Re: st: forvalues

> You should also read through the FAQ, which you are asked to do when
> joining the listserv. In particular you may want to read the section regarding
> the use of your name in the submissions that you send to the list. You also
> need to check which characters you are using, since your macro reference is
> using two right single quotes rather than a left single quotation mark and
> a right single quotation mark.
> 
> HTH,
> Billy
> 
> Sent from my iPhone
> 
> On Oct 23, 2012, at 5:14, - <dimpol7@googlemail.com> wrote:
> 
> > It still won't do it, it says "no observations", but there are
> > observations there...
> > 
> > On 23 October 2012 13:09, Henrik Støvring <STOVRING@biostat.au.dk>
> wrote:
> >> Your accents are off. You need to replace 'i' with `i' - note the
> >> difference in the first accent.
> >> 
> >> Best,
> >> 
> >> Henrik
> >> 
> >> On 10/23/2012 02:04 PM, - wrote:
> >>> hello all,
> >>> I'm trying to build a simple loop, and have looked at Help for
> >>> "foreach" and "forvalues", but can't get it to work. I just want to
> >>> set a variable i to take consecutive values from 1 to 53, so use
> >>> forvalues i=1/53, then give its value to a variable in my data called
> >>> "single" (refers to the number of samples for each person) which has
> >>> integer values ranging from 1 to 53, and create tables of statistics
> >>> for age in men and women. So there would be 53 tables of ages, one for
> >>> each number of samples, summarized by sex.
> >>> Haven't use loops in stata before, I write:
> >>> 
> >>> forvalues i = 1/53 {
> >>>   2. tabstat age if(single=='i'), by(sexcat) stats(mean sd n min max
> >>> median p10 p25 p75 p90)
> >>>   3. }
> >>> 
> >>> but the message is that 'i' is an invalid name. If I use
> >>> if(single==i), it says "i not found". Can anyone tell me what I'm
> >>> doing wrong?
> >>> 
> >>> Thank you all
> >>> *
> >>> *   For searches and help try:
> >>> *   http://www.stata.com/help.cgi?search
> >>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> >>> *   http://www.ats.ucla.edu/stat/stata/
> >> 
> >> --
> >> 
> >> *Henrik Støvring, PhD*
> >> Associate professor
> >> stovring@biostat.au.dk
> >> Phone +45 8716 7991
> >> Fax +45 8716 7305
> >> Web: au.dk/en/stovring@biostat <http://au.dk/en/stovring@biostat>
> >> 
> >> 
> >> 
> >> Department of Public Health
> >> Biostatistics
> >> University of Aarhus
> >> Bartholins Allé 2, Bldg 1261, 217
> >> DK-8000 Aarhus C
> >> Denmark
> >> 
> >> 
> >> Department of Public Health, Aarhus University
> >> 
> >> *
> >> *   For searches and help try:
> >> *   http://www.stata.com/help.cgi?search
> >> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> >> *   http://www.ats.ucla.edu/stat/stata/
> > 
> > *
> > *   For searches and help try:
> > *   http://www.stata.com/help.cgi?search
> > *   http://www.stata.com/support/faqs/resources/statalist-faq/
> > *   http://www.ats.ucla.edu/stat/stata/
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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