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: Σχετ: st: weekly minus monthly data
From
Nikolaos Kanellopoulos <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Σχετ: st: weekly minus monthly data
Date
Sun, 18 Sep 2011 18:03:34 +0100 (BST)
Nick,
thanks for the tip.
Nikos
----- Αρχικό μήνυμα -----
Απο: Nick Cox <[email protected]>
Προς: "[email protected]" <[email protected]>
Κοιν.:
Στάλθηκε: 6:14 μ.μ. Τρίτη, 13 Σεπτεμβρίου 2011
Θεμα: Re: st: weekly minus monthly data
If you were worried about efficiency, you need not -generate- the variable -diff- but on other grounds you do need it to check what you have done.
Nick
On 13 Sep 2011, at 15:17, Nikolaos Kanellopoulos <[email protected]> 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/
*
* 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/