Dataprocessing: how to insert an empty row if measurement of that time-slot is missing

#1
My data consist of many parameters, measured in a frequency of 1 second. At random moments a second is "skipped" from the data (see picture, 21:24:29 is skipped for instance). I would like to create an empty row where a second is skipped in my data, so that I can impute the datafile afterwards. Anyone an idea how to do that?

I prefer to use excel or SPSS, but I can also download R or python if necessary. Thanks in regards.
 

Attachments

Karabiner

TS Contributor
#2
It is supposed here that the time variable is named timevar.
First you have to save your datafile, using a different name.
Then you compute the missing seconds:

IF (CTIME.SECONDS(timevar-LAG(timevar)) > 1) flag = 1.
EXECUTE .

SELECT IF(flag=1).
EXECUTE .

COMPUTE timevar=DATESUM(timevar,-1,"seconds").
EXECUTE.

Save the new file (dropping flag), get the original file, and merge the original file with
the new file, using the "add cases" option.

HTH

Karabiner
 
#3
Thanks a lot!

It is supposed here that the time variable is named timevar.
First you have to save your datafile, using a different name.
Then you compute the missing seconds:

IF (CTIME.SECONDS(timevar-LAG(timevar)) > 1) flag = 1.
EXECUTE .

SELECT IF(flag=1).
EXECUTE .

COMPUTE timevar=DATESUM(timevar,-1,"seconds").
EXECUTE.

Save the new file (dropping flag), get the original file, and merge the original file with
the new file, using the "add cases" option.

HTH

Karabiner