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: appending date variable in 2 datafiles
From
<redacted>
To
[email protected]
Subject
st: appending date variable in 2 datafiles
Date
Wed, 17 Oct 2012 11:58:46 +0100
Hi all,
I have a date variable in a stata datafile :
DATAFILE A
+-----------+
doa
-----------
1. 14dec2010
2. 19dec2010
3. 30mar2010
4. 16jun2010
5. 06jan2010
+-----------+
and I have a date variable also in a stata datafile that I would like
to append to the datafile above (DATAFILE A)
DATAFILE B
+------------------------+
doa date3
------------------------
1. 23-05-2012 .
2. 03-11-2011 11mar2011
3. 02-09-2010 09feb2010
4. 01-07-2010 07jan2010
5. 18-04-2012 .
+------------------------+
The problem is both datafiles use different format of date, the former
uses numeric and the latter uses str. My questions would be
1) what is the best way to work around appending this two datafiles
2) i have converted the 'doa' in the latter file (DATAFILE B) using
generate date3=date(doa,"MDY")
format date3 %d
but only obs from 2 to 4 were converted but obs 1 and 5 were not.
Really appreciate if someone can help me with these 2 questions.
<redacted>
<redacted>
<redacted>
*
* 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/