Programming the statistical procedures from SAS

How do I evaluate a continuous time dependent covariate (SMA with lag) in 4 categories, using phreg?

Frequent Learner
Posts: 1

How do I evaluate a continuous time dependent covariate (SMA with lag) in 4 categories, using phreg?

Dear community,


I just registered for the following question, which (after some research) I suspect to be not covered so far.


I'm about to model longitudinal data from a non-randomized clinical cohort study with the endpoint fracture using proc phreg. With multiple observations per patid (time, event, therapy) data was organized in process style, but this can be adopted if necessary. The time under medication of a fracture preventing drug shall be considered. To avoid bias due to early events, I defined a continuous variable (sma_c), the simple moving average of the time under therapy over the last year. Thus, previous full 12 months therapy (at a time) will lead to the value of 1, a break of at least 12 months to the value of 0, and a change or small breaks will cause values between zero and one. All of that is clearly time dependent, to be evaluated in risk sets at each event time of the cohort. 


My problem starts, where it is hypothesised, that fracture risk is not monotone with decreasing sma_c, e.g. short breaks might have higher risk then full therapy; middle breaks might have lower risk than long breaks, and so on. Therefore a straightforward analysis of sma_c as a continuous variable is meaningless. Nevertheless, I applied it to find the calculation of sma_c seems to be working.


That said, next, I did (or not, check my code please) categorization of sma_c into 4 levels of sma (class variable) following the calculation of sma_c, whichs follows the model statement.

I was thinking that, once given the value of sma_c, I can categorize afterwards. But sas-log says sma has only one level. I further tried a format statement for sma_c which has no effect.

Since focus will be the hazard comparison of certain levels of sma, my question is how to script this? Do you think, it is possible? Any ideas?


Thanks for you time.


PS: Please find my attached simplified code.

PPS: How to export calculated values of sma (sma_c) for debugging?


Ask a Question
Discussion stats
  • 0 replies
  • 1 in conversation