Dear All,

I am running a logistic FE regression to estimate a the effect of a 'treatment' using a generalized difference-in-difference model and a binary outcome variable. Its a two period model - pre and post treatment.
Different individuals are treated at different calendar times and are thus, the 'exposure' variable captures for each individual the length in days that they are in the treated group.
My data looks as follows:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double studypersonid float(treat post exposure) double opioidpois float age
103336 1 0 2319 0 35.666668
103336 1 1  730 1 37.416668
103338 1 0 2137 0  45.41667
103338 1 1  912 0  47.16667
103342 1 0 1834 0        37
103342 1 1 1215 0     37.75
103344 0 0 3049 0    29.875
103344 0 1 3049 0 31.916666
103345 0 0 3049 0     58.75
103345 0 1 3049 1  59.10417
103346 1 0 2021 0        56
103346 1 1 1028 1     58.75
103347 0 0 3049 0        30
103347 0 1 3049 1     31.25
103350 0 0 3049 0  56.95025
103350 0 1 3049 0  59.62333
103351 0 0 3049 0  44.83333
103351 0 1 3049 1  46.72222
103355 0 0 3049 0  43.31452
103355 0 1 3049 1  44.97222
103365 1 0 1969 0        57
103365 1 1 1080 1  59.66667
103370 1 0 1842 0 35.583332
103370 1 1 1207 0  39.16667
103374 0 0 3049 1 31.166666
103374 0 1 3049 0     31.75
103375 1 0 1961 0 37.583332
103375 1 1 1088 1  38.64583
103389 0 0 3049 0    25.875
103389 0 1 3049 0 28.114584
103391 1 0 1901 1 34.666668
103391 1 1 1148 1    35.875
103394 0 0 3049 1  43.33333
103394 0 1 3049 0        45
103396 0 0 3049 0 21.916666
103396 0 1 3049 1 24.833334
103399 1 0 1906 1  55.55555
103399 1 1 1143 0  57.66667
103401 1 0 2173 0 35.666668
103401 1 1  876 0 37.583336
103402 1 0 2064 1  47.66667
103402 1 1  985 0  50.38095
103403 0 0 3049 0 36.795597
103403 0 1 3049 1  40.27778
103404 0 0 3049 0     38.75
103404 0 1 3049 0     40.25
103408 0 0 3049 0 32.666668
103408 0 1 3049 0      34.5
103413 0 0 3049 0  57.86111
103413 0 1 3049 1  59.98214
103418 0 0 3049 0 21.916666
103418 0 1 3049 1  24.02778
103420 0 0 3049 1 35.814816
103420 0 1 3049 1  39.32143
103421 1 0 1932 0 32.416668
103421 1 1 1117 0 33.333332
103423 0 0 3049 0     24.25
103423 0 1 3049 0 25.166666
103425 1 0 2390 0 21.416666
103425 1 1  659 1    23.625
103428 0 0 3049 0     27.75
103428 0 1 3049 1 29.819445
103430 1 0 2082 0     40.25
103430 1 1  967 1  41.66667
103435 1 0 2053 0 30.416666
103435 1 1  996 0    31.375
103440 1 0 1905 0 20.916666
103440 1 1 1144 0        22
103441 0 0 3049 0  55.51042
103441 0 1 3049 0  56.85049
103442 0 0 3049 1 36.166668
103442 0 1 3049 0      37.5
103449 0 0 3049 1 19.583334
103449 0 1 3049 0     20.75
103454 1 0 1898 0  49.52778
103454 1 1 1151 1  51.83333
103456 1 0 2030 0  52.33334
103456 1 1 1019 1  54.08334
103462 0 0 3049 1  53.31723
103462 0 1 3049 0  57.53472
103472 1 0 1880 0  38.44444
103472 1 1 1169 1  39.19445
103475 0 0 3049 0 24.680555
103475 0 1 3049 0  27.29167
103484 0 0 3049 0 35.333332
103484 0 1 3049 0     36.25
103488 1 0 2062 0      34.5
103488 1 1  987 0 35.083332
103489 0 0 3049 0 36.229168
103489 0 1 3049 1        38
103492 0 0 3049 1 29.666666
103492 0 1 3049 1 30.423077
103497 0 0 3049 0  56.02778
103497 0 1 3049 0  56.58334
103498 0 0 3049 0  48.33333
103498 0 1 3049 0     48.75
103500 0 0 3049 0      31.5
103500 0 1 3049 0        34
103505 1 0 2126 0 33.583332
103505 1 1  923 1 36.041668
end
In my estimation I want to take into account the different treatment exposure periods. If this were a count data model I would include an 'exposure' variable to account for different durations of exposure to treatment. How should I do that in an xtlogit regression? Right now I have estimated the following:

Code:
. eststo raw1: xtlogit opioidpois i.post did age, fe
note: multiple positive outcomes within groups encountered.
note: 609 groups (1,218 obs) dropped because of all positive or
      all negative outcomes.

Iteration 0:   log likelihood = -481.84658 
Iteration 1:   log likelihood =   -384.481 
Iteration 2:   log likelihood = -383.05408 
Iteration 3:   log likelihood = -383.05124 
Iteration 4:   log likelihood = -383.05124 

Conditional fixed-effects logistic regression   Number of obs     =      1,706
Group variable: studypersonid                   Number of groups  =        853

                                                Obs per group:
                                                              min =          2
                                                              avg =        2.0
                                                              max =          2

                                                LR chi2(3)        =     416.41
Log likelihood  = -383.05124                    Prob > chi2       =     0.0000

------------------------------------------------------------------------------
  opioidpois |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      1.post |   .6571757   .2257941     2.91   0.004     .2146274    1.099724
         did |   1.332142   .1859222     7.17   0.000      .967741    1.696543
         age |   .0764154   .0991872     0.77   0.441    -.1179879    .2708186
------------------------------------------------------------------------------

. eststo margin1: margins, dydx(did) post

Average marginal effects                        Number of obs     =      1,706
Model VCE    : OIM

Expression   : Pr(opioidpois|fixed effect is 0), predict(pu0)
dy/dx w.r.t. : did

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         did |   .0565268   .1390073     0.41   0.684    -.2159225    .3289761
------------------------------------------------------------------------------
I will be grateful for your help.
Sincerely,
Sumedha.