Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: data management - days into weeks


From   Maria Cecilia Vieira da Silva <[email protected]>
To   "[email protected]" <[email protected]>
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index