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: Finding the corresponding variable
From
Ching Wong <[email protected]>
To
[email protected]
Subject
st: Finding the corresponding variable
Date
Sun, 7 Apr 2013 13:54:49 +0930
Hi,
I have TWO variables of dates, called "datea" and "dateb". I would
like to calculate the number of days between a particular date (says,
1/01/2013) and the closest day either "datea" or "dateb".
Firstly, I generated one variable called "var1" which is the number of
days between the particular date and "datea" and also generated
another variable called "var2" which is the number of days between the
particular date and "dateb".
Then I set up another variable "var3" in order to choose the minimun
number of days between "var1" and "var2". By using the Command as
following:
---> egen var3 = rowmin (var1 var2).
My question is that after getting "var3", how I can list the
corresponding "datea" or "dateb"?
i.e. var3---> var1 or var2----> datea or dateb
Thank you for your time.
Best regards,
Wong
*
* 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/