Bookmark and Share

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

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

st: weekly minus monthly data

From   Nikolaos Kanellopoulos <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: weekly minus monthly data
Date   Tue, 13 Sep 2011 15:17:06 +0100 (BST)

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

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index