Hi everyone.
The scenario is this:
A participant (par) needs to visit a center for three times to receive medication. The initial visit is the baseline. The second visit happens 6 months after and the last visit happens after a year from the first visit (twelvemonths). During each visit, the number of medications is counted (count).
How do I determine if the number of medications is significantly different across the three visits and participants?
Note: The initial visit date is different for each participant.
Thank you.
data setup;
input par $ 1-5 visit $ 8-19 count 21-22;
datalines;
par1 baseline 2
par1 sixmonths 0
par1 twelvemonths 2
par2 baseline 0
par2 sixmonths 0
par2 twelvemonths 1
par3 baseline 4
par3 sixmonths 2
par3 twelvemonths 5
par5 baseline 4
par5 sixmonths 2
par5 twelvemonths 2
par6 baseline 0
par6 sixmonths 1
par6 twelvemonths 1
par7 baseline 7
par7 sixmonths 3
par7 twelvemonths 3
par8 baseline 4
par8 sixmonths 5
par8 twelvemonths 5
par9 baseline 14
par9 sixmonths 2
par9 twelvemonths 6
par10 baseline 4
par10 sixmonths 4
par10 twelvemonths 8
;
run;
you can try the below code and we get the below results
The initial table in this listing is the Analysis of Variance Table. The most important line to observe in this table is the “Model.” At the right of this line is the p-value for the overall ANOVA test. It is listed as “Pr > F” and is p = 0.2892. This tests the overall model to determine if there is a difference in means between visits. In this case, since the p-value is large, you can conclude that there no significance difference between visit (medications) ie. visits mean are equal. we fail to reject the null hypothesis.
proc anova data=setup;
class visit;
model count=visit;
run;
I think you should post it at Stat forum since it is about statistical question.
And try RPOC GLIMMIX + Possion or Tweedie distribution .
Hi @yoyong555
In my opinion, you should use a Friedman test, as you have paired measures.
It involves ranking each row (=block represented by the variable 'par') together, then considering the values of ranks by columns (= variable 'visit'.
In SAS, the Friedman test can be done with PROC FREQ. The CMH2 SCORES=RANK option gives the Friedman test.
The p-value is given in the "Row Mean Scores Differs" of the output.
proc freq data=setup;
table visit*par*count / cmh2 scores=rank noprint;
run;
@yoyong555 you have not answered my questions from your earlier thread ... what distribution do you want to assume for this data?? It probably isn't normal, but what do you think is the right distribution?
Okay, Poisson (although I'm a little skeptical, let's go with that)
If there were only two different levels of VISIT, this could be analyzed using the traditional "paired t-test" or whatever the Poisson equivalent is. You can obtain the equivalent of a "paired t-test" in a generalized linear model by placing the participant into the model as a class variable.
proc glimmix data=setup;
class par visit;
model count=par visit/dist=poisson;
lsmeans visit/ilink lines;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.