Please help. In my data set the dates are in the format: 17dec2016 00:00:00. I am trying to subtract one date to the other but am getting it in milliseconds, I believe.
I have generated day_since_con using : gen day_since_con = (episode_start_dt - concuss_onset) and get the results below. I just want days.
I have tried to convert by using; quietly gen double con_on_dt = date(concuss_onset, "YMD")
No luck. Can you advise on how to convert these to the proper format so I can get days when I subtract one date from the other?
clear
input double(concuss_onset episode_start_dt) float day_since_con
1.7832096e+12 1.8076608e+12 2.44512e+10
1.7201376e+12 1.8110304e+12 9.08928e+10
1.8067968e+12 1.8077472e+12 9.504e+08
1.797552e+12 1.8063648e+12 8.8128e+09
1.8026496e+12 1.8129312e+12 1.02816e+10
1.8086976e+12 1.81008e+12 1.3824e+09
1.8004896e+12 1.80576e+12 5.2704e+09
1.8036e+12 1.8062784e+12 2.6784e+09
1.7749152e+12 1.799712e+12 2.47968e+10
1.8042912e+12 1.8065376e+12 2.2464e+09
1.8077472e+12 1.809216e+12 1.4688e+09
1.8000576e+12 1.8041184e+12 4.0608e+09
1.798416e+12 1.8035136e+12 5.0976e+09
1.8004032e+12 1.8080064e+12 7.6032e+09
1.7961696e+12 1.809216e+12 1.30464e+10
1.7974656e+12 1.8075744e+12 1.01088e+10
1.8037728e+12 1.8112896e+12 7.5168e+09
1.8055872e+12 1.813104e+12 7.5168e+09
1.8240768e+12 1.8279648e+12 3.888e+09
1.8146592e+12 1.8162144e+12 1.5552e+09
1.835136e+12 1.8379872e+12 2.8512e+09
1.8132768e+12 1.8257184e+12 1.24416e+10
1.8277056e+12 1.8421344e+12 1.44288e+10
1.8245952e+12 1.8309888e+12 6.3936e+09
1.8149184e+12 1.8367776e+12 2.18592e+10
1.8559584e+12 1.8372096e+12 -1.87488e+10
1.828224e+12 1.8328896e+12 4.6656e+09
1.8331488e+12 1.839456e+12 6.3072e+09
1.8254592e+12 1.8304704e+12 5.0112e+09
1.8379872e+12 1.8404064e+12 2.4192e+09
1.842048e+12 1.845504e+12 3.456e+09
1.53144e+12 1.8268416e+12 2.954016e+11
1.82088e+12 1.8225216e+12 1.6416e+09
1.7959968e+12 1.823904e+12 2.79072e+10
1.8236448e+12 1.8262368e+12 2.592e+09
1.8155232e+12 1.8376416e+12 2.21184e+10
1.8337536e+12 1.8395424e+12 5.7888e+09
1.8304704e+12 1.8304704e+12 0
1.8367776e+12 1.8396288e+12 2.8512e+09
1.8333216e+12 1.8340128e+12 6.912e+08
1.8347904e+12 1.8359136e+12 1.1232e+09
1.8257184e+12 1.8360864e+12 1.0368e+10
1.8604512e+12 1.8331488e+12 -2.73024e+10
1.8197568e+12 1.8216576e+12 1.9008e+09
1.8408384e+12 1.8427392e+12 1.9008e+09
1.8213984e+12 1.824336e+12 2.9376e+09
1.8326304e+12 1.8360864e+12 3.456e+09
1.8007488e+12 1.8197568e+12 1.9008e+10
1.8065376e+12 1.8136224e+12 7.0848e+09
1.8198432e+12 1.8275328e+12 7.6896e+09
1.8236448e+12 1.8361728e+12 1.2528e+10
1.8320256e+12 1.833408e+12 1.3824e+09
1.8248544e+12 1.8276192e+12 2.7648e+09
1.7908992e+12 1.8250272e+12 3.4128e+10
1.8207936e+12 1.8313344e+12 1.05408e+10
1.8313344e+12 1.8373824e+12 6.048e+09
1.8108576e+12 1.836432e+12 2.55744e+10
1.8330624e+12 1.8418752e+12 8.8128e+09
1.8203616e+12 1.8231264e+12 2.7648e+09
1.8280512e+12 1.836e+12 7.9488e+09
1.8417024e+12 1.84464e+12 2.9376e+09
1.8294336e+12 1.8408384e+12 1.14048e+10
1.8423072e+12 1.845072e+12 2.7648e+09
1.8239904e+12 1.8245088e+12 5.184e+08
1.832112e+12 1.8328896e+12 7.776e+08
1.8447264e+12 1.845504e+12 7.776e+08
1.8132768e+12 1.814832e+12 1.5552e+09
1.8263232e+12 1.831248e+12 4.9248e+09
1.8319392e+12 1.8376416e+12 5.7024e+09
1.8160416e+12 1.8245088e+12 8.4672e+09
1.7588448e+12 1.8372096e+12 7.83648e+10
1.832976e+12 1.837728e+12 4.752e+09
1.8241632e+12 1.8245952e+12 4.32e+08
1.8238176e+12 1.845072e+12 2.12544e+10
1.8177696e+12 1.8414432e+12 2.36736e+10
1.84248e+12 1.8428256e+12 3.456e+08
1.8393696e+12 1.843776e+12 4.4064e+09
1.8167328e+12 1.8251136e+12 8.3808e+09
1.8209664e+12 1.8252e+12 4.2336e+09
1.7991936e+12 1.8336672e+12 3.44736e+10
1.806624e+12 1.8220896e+12 1.54656e+10
1.8373824e+12 1.8440352e+12 6.6528e+09
1.830384e+12 1.841616e+12 1.1232e+10
1.8169056e+12 1.8261504e+12 9.2448e+09
1.824336e+12 1.8252e+12 8.64e+08
1.839888e+12 1.8426528e+12 2.7648e+09
1.8408384e+12 1.8448992e+12 4.0608e+09
1.8144864e+12 1.83168e+12 1.71936e+10
1.8185472e+12 1.8209664e+12 2.4192e+09
1.803168e+12 1.8176832e+12 1.45152e+10
1.8068832e+12 1.8228672e+12 1.5984e+10
1.8229536e+12 1.8251136e+12 2.16e+09
1.823904e+12 1.8335808e+12 9.6768e+09
1.8250272e+12 1.8252e+12 1.728e+08
1.8169056e+12 1.8185472e+12 1.6416e+09
1.8289152e+12 1.8292608e+12 3.456e+08
1.8379008e+12 1.8391104e+12 1.2096e+09
1.8259776e+12 1.8330624e+12 7.0848e+09
1.8318528e+12 1.8413568e+12 9.504e+09
1.8244224e+12 1.8245088e+12 8.64e+07
end
format %tc concuss_onset
format %tc episode_start_dt
Related Posts with subtracting dates
ForvalHi, I have this little problem with the following code: clear all forval i=1/1{ use 201`i'-1.dta me…
More examples with codes on Econometric model forecastingSTATA manual has example of Klein's model on macro forecasting. Also it has one model with cross sec…
Regressions with multiple splitsHi! I have a question regarding regression output I would like to get as efficiently as possible. I…
How to incorporate exposure variable in Zero Truncated Negative Binomial ModelHello All, This is my first time using this platform, so apologies in advance for any faux pas. Als…
Creating variables from textHi, I got some survey data. The raw data is in text, like for example there was a question about ed…
Subscribe to:
Post Comments (Atom)
0 Response to subtracting dates
Post a Comment