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]

st: generate a variable for Project Week


From   Michael McCulloch <mm@pinestreetfoundation.org>
To   statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index