Hi,
Suppose I have two waves of a survey. I make use of a DID.


The treatment is whether a particular HH_member passed away by wave 2.
I restricted the sample to those respondents living with that hh member in wave 1.
The treatment dummy takes the value 0 if HH-member is alive and 1 if the HH member died.
Post takes value 0 if the observation is in wave 1 and takes value 1 if in wave 2.

The regression I run to get DID output is
Code:
reg outcome i.HH_member_died##i.post $controls $FE , cl(var)

I try to look at the descriptive statistics of two groups at the baseline to see if any statistical difference exists at the baseline between them.
1) respondents for whom the hh_member was alive in wave1 but passed away by wave2
2) respondents for whom the hh_member was alive in wave 1 and remained alive even in wave 2.

I run the following command
Code:
keep post==0
ttest outcome, by(HH_memeber_died)
But this shows the difference between groups for whom the HH_member was died and alive in wave 1. Not the difference between these two groups in wave 1 for whom the HH_member passed away in wave2 and the other did not.

How can I get that?


Code:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double BMI_survey float(HH_member_died post)
25.4386425018 0 0
16.9948692322 0 0
30.0425415039 0 0
29.6986141205 1 1
26.7642993927 1 1
20.6010570526 0 1
25.5052757263 1 1
23.8579883576 0 1
22.4769897461 0 0
21.7111110687 0 0
20.8466835022 0 0
25.7420845032 0 0
17.8782272339 0 0
25.3662319183 1 1
22.0370044708 0 1
19.8885383606 0 0
21.9642086029 0 1
29.1248645783 1 1
            . 1 1
20.7804164887 1 1
 19.079946518 0 0
29.4948539734 0 0
 21.731502533 0 0
24.1133422852 0 0
14.3230552673 1 1
23.4682006836 0 1
 21.426651001 1 1
19.5180568695 0 1
  22.80884552 1 1
27.1408443451 1 1
33.8613395691 0 0
 21.102804184 0 0
21.5114250183 0 0
21.3299102783 1 1
 23.688167572 1 0
31.5484447479 1 1
26.3711357117 1 1
28.5294895172 0 0
22.6051673889 1 1
22.8827972412 1 0
18.0570392609 1 0
  21.54296875 0 1
17.9458408356 0 1
29.5692863465 0 1
 20.625705719 1 1
22.8537845612 1 0
20.0530490875 1 1
25.8380050659 1 1
24.6478939057 0 1
21.3943805695 0 0
28.6160259247 0 0
25.1688022614 0 0
17.9838981629 0 0
26.0739994049 1 1
21.6328411102 1 1
21.1121730805 1 1
26.4681358338 0 1
 24.112241745 0 1
24.8491153717 0 0
20.7447032929 0 0
21.5888004303 1 0
25.0364208222 0 0
24.9698143005 0 1
24.6674957276 0 1
18.8573570252 1 1
17.0916538239 1 1
18.9992809296 1 1
13.7701473236 1 1
30.8436298371 0 0
23.0513725281 1 0
24.9562129974 1 1
23.4150829315 1 1
23.6802539826 1 1
39.5971870423 0 0
24.2142925263 1 0
28.9832057953 1 1
    25.234375 1 0
34.2484893799 1 1
21.8441505432 0 1
34.4006996155 0 0
21.1394233704 0 0
32.6331367493 0 0
26.7796020508 1 1
25.7466068268 1 1
21.3556995392 0 1
29.2932777405 1 1
23.8346385956 0 0
30.2977848053 0 0
24.3925933838 0 1
30.3410663605 1 0
22.2304401398 1 0
20.5079307556 0 0
23.6710567474 1 0
24.0117797852 1 0
20.9045200348 1 1
 26.642944336 0 1
21.9777774811 0 0
17.3138198853 0 0
25.1688022614 1 0
23.3634643555 0 0
end
------------------ copy up to and including the previous line ------------------