Bookmark and Share

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: type mismatch error when trying to convert a date in stata format


From   Raffaele Palladino <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: type mismatch error when trying to convert a date in stata format
Date   Wed, 19 Feb 2014 13:42:08 +0000

Dear statalist users, I am dealing with the follow:
I need to convert dates from an excel file to dates in stata format. I
am using a do file I wrote time ago when I worked with the same
database but this time it keeps saying type mismatch.
Basically what I do is to copy the data from the excel sheet and I
past them in the stata editor. All the dates are recognized as string,
then I use these commands;

encode oldvar, generate(newvar)

gen vardate =date(newvar, "DMY")

format vardate %td


I do not know why it keeps saying typing mismatch when it comes to run
the date function since it used to work perfectly.

Anyway the data format in excel is in DD/MM/YYYY, I even tried to
convert it in day month year format but without success

thanks in advance!
*
*   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/


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