Hello Stata friends! I have panel data that I have declared as time series based on a unique time variable named "elapsedtime" with 1 minute delta between each observation. I am now trying to fill in the date variable and components of the date (year, doy, hr, min) for those new observations created during the tsfill.
The following code did not work but I hope it is close.
This is an example of the data
Thanks in advance for your thoughts on this
The following code did not work but I hope it is close.
Code:
replace time = (time[-n-1]+1) if time==.
Code:
replace time = time[-n-1]+1 if time>=.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(ID_Sess date year doy hr min elapsedtime) 1 21827 2019 278 18 19 1517 1 21827 2019 278 18 20 1518 1 21827 2019 278 18 21 1519 1 . . . . . 1520 1 . . . . . 1521 1 . . . . . 1522 1 . . . . . 1523 1 . . . . . 1524 1 . . . . . 1525 1 . . . . . 1526 1 . . . . . 1527 end format %td date
Comment