I've received 100 excel data files, which I have imported and appended to a single dta file by using " xls2dta" (from ssc: ssc install xls2dta)
I have trouble with the imported date variables- they seem to be automatically formated in %tc: In the Stata data editor they seem to look allright- e.g id=2 is " 05sep2020 09:22:59" and id=5 is "31mar2020 17:03:59"
However, the format appears wrong or at least difficult to reformat, see below.
I would like to get the data in a proper Stata day-date format without clock of day.
Obviously would be tedious to change the date format in each excel file before the import
* Example generated by -dataex-. To install: ssc install dataex
clear
input float id double prv_taget
2 1914916979980.8
3 1914916979980.8
4 1914916979980.8
5 1901293439990.4
6 1901293439990.4
7 1901293439990.4
end
format %tc prv_taget
thanks, Jannik
0 Response to Excel time- how to re-format in stata after xlsdta import?
Post a Comment