Continuous Treatment effect to assess the impact of Early vs Late treatment I have an observational dataset with only treated observations with different ages, but treated at different times for 7 years. Each treatment had different durations; from 2 days to 160 days. The outcome variable is continuous measured at the same point in time for all observations after 7 years elapsed from the time of the 1$^{st}$ treatment. The cofounders were time invariant.
I would like to measure the causal impact of the treatment on my dependent variable. In particular, treatments occurring at an early age, affected the outcome more so than for older subjects.
The Generalized Propensity Score (gspsore in Stata) with the focus on dose-response function is not interesting for me given that I don't care about the impact of the treatment duration, but rather about the early versus late time of treatment administration.
I have tried to consider the early treatments as "treated" and late treatments as "control" groups and run a normal PSM (psmatch2 in Stata), but this definition is blurry given that in the end all subjects were treated.
What will be the most suitable method of testing for differences?
 A: You are probably interested in accelerated failure time models. These will, unlike Cox models, account for the interaction between fixed effects and time-at-risk  in the study. 
The Cox model does not work because it models the hazard: A hazard is an instantaneous risk of failure. If most people die after receiving the treatment, the Cox model has no power to detect an effect. You cannot model time at-risk as an exposure or outcome because it is continuously varying, as you allude to earlier. One crude way of overcoming this is by binning time into equal intervals and entering each participant in a staggered entry with a time-varying covariate that increments at each subsequent duration of study interval. The idea of calculating the limit with a finer and finer stratification of time ultimately leads to AFTs. 
The AFT models are a generalization of the Cox models. A "negative" (<1) risk ratio for treatment initiation indicates that earlier treatment tends to be associated with better health outcomes. However, adjustment for confounding becomes quite complicated. You allude to propensity models, so using a propensity matched dataset alleviates this problem somewhat by balancing the design in the distribution of confounders. You can read more about AFT-models on wikipedia here.
A more rigorous resource is Kalbfleisch JD, Prentice RL (2002). "The Statistical Analysis of Failure Time Data". John Wiley & Sons. Also consider LJ Wei (1992) "The accelerated failure time model: A useful alternative to the cox regression model in survival analysis" https://doi.org/10.1002/sim.4780111409 
A: As I understand, you are having a continuous treatment. If that is the case, you may find the following references on continuous treatment helpful:
Hirano & Imbens (2004), Imai and van Dyk (2004), and Kennedy et al. (2016).
