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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: forming groups by an ordered number


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: forming groups by an ordered number
Date   Fri, 22 Jun 2012 19:58:25 +0100

See also the -egen- function -seq()-.

Nick

On Fri, Jun 22, 2012 at 5:34 PM, Joerg Luedicke
<joerg.luedicke@gmail.com> wrote:
> Say your variable is called -days-, you could type:
>
> gen week=ceil(days/7)
>
> On Fri, Jun 22, 2012 at 11:10 AM, rado645-bg@yahoo.de
> <rado645-bg@yahoo.de> wrote:
>
>> I have a sequence of numbers that indicate days prior to a given event: (1, 2, 3, 4, 5... up to 90).
>>
>>
>> Out of this sequence I would like to have a frequency on a weekly basis. I mean that numbers 1,2...7 take the value of 1 (i.e. this is week 1), numbers 8,9,10, 11...14 take the value of 2.
>>
>> Could one help me with that?
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index