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: AW: Date conversion in batch


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: Date conversion in batch
Date   Sun, 18 Apr 2010 17:26:40 +0200

<> 



Can you give an example what your problem looks like? So you got to the
point that you are dealing with dates that are formatted inconsistently. Can
you provide an example dataset via -input- that makes the resulting mess
clearer to the list?



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Simon
Gesendet: Sonntag, 18. April 2010 14:34
An: [email protected]
Betreff: st: Date conversion in batch

Dear Statalist,

I have been sent a load of excel files that I want to combine into one 
Stata file for analysis. First I use Roger Newson's stcmd with 
Stat-transfer to convert the files to Stata files:

clear
cd "`dir'"
stcmd *.xls *.dta /y

and then use Nick Cox's -fs- to

set obs 0
g age = .
g date = ""

fs *.dta
foreach f in `r(files)' {
local fn = "`dir'\`f'"
append using "`fn'"
}

My problem is that date, coming from excel, is all over the place. 
There's the text version of dd/mm/yyyy and the excel version of 
dd/mm/yyyy and then various other formats including ddmmyy and ddmmyyyy.

Just wondering if anyone had come across something similar and whether 
there is an easy solution - or am I destined to do this all by hand?

Simon


*
*   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/


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