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: generate a variable for Project Week


From   Michael McCulloch <[email protected]>
To   [email protected]
Subject   st: generate a variable for Project Week
Date   Mon, 27 May 2013 10:29:07 -0700

Hello,
To generate a variable for elapsed Project Week, I have written the following manual commands, in which the first Project Week is May 6, 2013 through May 12, the second week is May 13 through the 19th, and on forward:

gen week=1 if date>=mdy(5,6,2013) & date<mdy(5,12,2013)  
replace week=2 if date>=mdy(5,13,2013) & date<mdy(5,19,2013)  

Is there a shorter more elegant way to accomplish this?


Best wishes,
Michael McCulloch, LAc MPH PhD

--
Pine Street Foundation, since 1989
124 Pine Street | San Anselmo | California | 94960-2674  
P: (415) 407-1357 | F: (206) 338-2391 | http://www.PineStreetFoundation.org


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index