Dear All,

I would really be grateful if you could help me with this as I have spent more than a month figuring out the correct way to do this but still am confused.

I’m looking at the trends in the individual comorbidities, death, length of stay of a particular diagnosis over the years.

I found out that the trends in proportions of comorbidities over years is by “ptrend”. But the way the data should be entered is very specific for this command. The problem is I can’t manually enter the data that is in millions. So I try to do it in 2 following ways: For example, for CAD comorbidity: I calculate individual proportion of CAD each year (n1) and then remaining (100-n1) would be n2 and then put this data in a separate excel to be analyzed by STATA for trend over the years by command “ptrend n1 n2 Year”. Other way is- I create a dummy variable of “n2=1 if n1==0” in the existing data and again ran the analysis with the command “ptrend n1 n2 Year”. The problem is, I’m getting a different P value but these methods. So I’m not sure if I’m doing either of them correctly or not.

One of my colleagues said “nptrend” and also be used to assess the trends of categorical variable over the years. But my understanding was in “nptrend” is for looking at the trends in the continuous variables only (for example, length of stay in days). Is that correct?

Plus, my understanding is I have to expand the weight variable before running either of these commands. Is that correct?

I have read all the blogs and online questions available on this topic of trend analysis in STATA but everything lead to so much confusion. I just want to use the “ptrend” and the “nptrend” commands correctly in order to get the correct p values of trends. In summary, can I just use the “nptrend” or “vwls” command for both categorical (0/1) variables and continuous variables, after expanding the weights? Please guide.