Hello Statalist,

I have the following data:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double(Sec Unit mean_sec) float(mean_end mean_start diff)
12 2215 2 3 4 -1
13 2215 2 3 4 -1
14 2216 4 5 6 -1
15 2216 4 5 6 -1
16 2216 4 5 6 -1
17 2217 3 4 5 -1
18 2217 3 4 5 -1
19 2218 3 6 7 -1
20 2218 3 6 7 -1
21 2218 5 6 7 -1
22 2218 5 6 7 -1
23 2218 5 6 7 -1
24 2219 5 4 5 -1
25 2219 4 4 5 -1
end
label values Unit v2_Num
label def v2_Num 2215 "05-002", modify
label def v2_Num 2216 "05-003", modify
label def v2_Num 2217 "05-004", modify
label def v2_Num 2218 "05-005", modify
label def v2_Num 2219 "05-006", modify


The dataset is much larger, but those are the relevant variables.
It is based on seconds.
'Unit' defines multiple units of various length. Mean_start is the mean for the first second of a unit, mean_end of the last.
'diff' is mean_ende minus mean_start. I would like to run a dependent ttest to test whether this difference is significant, seperate for each unit.

What I did is:
bysort Unit: ttest mean_ende == mean_start

It runs, but it leaves the field for the t-value empty and therefore also for the p-value.

Does anybody know what went wrong?

Thank you!