Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: weekly minus monthly data |
Date | Tue, 13 Sep 2011 16:14:35 +0100 |
NickOn 13 Sep 2011, at 15:17, Nikolaos Kanellopoulos <nkkanel@yahoo.gr> wrote:
Dear all,I have information regarding the month and year during which a rental contract was signed (sign_year & sign_month) and the year and week of the survey (surv_year & surv_week). I want to identify the contracts which were signed in less than three months from the week of the survey. My approach is to convert everything in monthly data and calculate the difference using the following:gen date1 = mofd(dofw(yw( surv_year,surv_week ))) gen date2 = ym( sign_year , sign_month) gen diff = date1 - date2 keep if diff<4 Two questions:1) Is my approach correct. For a few individuals I get negative values. I suppose that this can occur if the week of the survey is within the month that the contract was signed.2) Ii my approach is correct is there a better (more efficient) way to do this?Kind regards Nikos * * 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/
* * 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/