Hi All,
Hi All,
I have a large dataset with dates of visits and dates of purchases for each customer. The data looks like this:
HTML Code:
customer_no visit date purchase date 10 20-10-2014 NA 10 NA 12-01-2013 10 17-06-2011 NA 10 NA 18-02-2012 30 22-12-2013 NA 30 14-07-2012 NA
I would like to generate a new variable that gives me the days of difference between FIRST visit and FIRST purchase. So, STATA should be able to identify which date is the first in the visits column for each unique customer_no, identify which date is first in the purchase column for the same customer_no and then calculate the difference.
Presumably the new column will be all NA and one value per customer.
Thanks!!
Hi All,
I have a large dataset with dates of visits and dates of purchases for each customer. The data looks like this:
HTML Code:
customer_no visit date purchase date 10 20-10-2014 NA 10 NA 12-01-2013 10 17-06-2011 NA 10 NA 18-02-2012 30 22-12-2013 NA 30 14-07-2012 NA
I would like to generate a new variable that gives me the days of difference between FIRST visit and FIRST purchase. So, STATA should be able to identify which date is the first in the visits column for each unique customer_no, identify which date is first in the purchase column for the same customer_no and then calculate the difference.
Presumably the new column will be all NA and one value per customer.
Thanks!!
Comment