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?
Looping running sum and total for changing range within grouped variables.Hi everyone, I'm relatively new to Stata so please excuse if the explanation of my problem sounds a…
saving two files using foreachDear statalist, I tried to load two files, make some changes, and save them in one go. However I ju…
Lagged non-linear independent variablesI came across a paper that write the following: The first set of independent variables, REPRESSION(1…
Total sum of squares when using reg and noconstant In the artificial data set below I estimated depvar = beta0 + beta1*year and depvar = beta1*year. U…
Plotting residuls for first and second stage of "SLSDear Stata experts, i am using 2sls to estimate the impact of water quality on health with state 14…
Subscribe to:
Post Comments (Atom)
0 Response to Excel time- how to re-format in stata after xlsdta import?
Post a Comment