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
Related Posts with Excel time- how to re-format in stata after xlsdta import?
Postfile command gives error/notification ''File not found''Dear all, I ran the following code in Stata: Code: clear all set seed 312312 set obs 100 gen t = _…
How to add two variables with one conditions each using graph barI would like to graph two variables with one condition each. For example, I would like to graph wage…
Comparing survival curves for imputed dataHow can we test/compare survival curves after multiple imputations? …
Struggle with interpretation of time-invariant industry effectsDear all, I'm currently writing my pre-master thesis. For my thesis, I have panel data and ran a Ne…
Interactions not allowedDear Stata users I am running the following code: eststo: quietly asreg ret r1 r1##avg, fmb est…
Subscribe to:
Post Comments (Atom)
0 Response to Excel time- how to re-format in stata after xlsdta import?
Post a Comment