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]

st: data management - days into weeks


From   Maria Cecilia Vieira da Silva <mcvieira@mapigroup.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: data management - days into weeks
Date   Tue, 6 Mar 2012 23:48:40 +0000

Hello all,
In my data set I have "day", a variable that indicates the day of treatment of a patient. Example:
 
Patient=1
 
Day=5
Outcome x1=6
Outcome x2=0.5
 
Day=10
Outcome x1=5
Outcome x2=0.6
 
I would like to create a variable "week", where week=1 if day<=7; week=2 if 7<day<=14 and so on.
Any suggestion about how to create "week" without my having to write the conditions for each week of the year up to week 52?
The date functions do not help me because my data set does not contain 'dates'.
 
Thanks,
Maria Cecilia
*
*   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