Your code should work if you treat AVISITN as a continuous variable. If that is what you want, you might want to create another variable avisit = avisitn, put avisit in the CLASS statement (take avisitn out of the CLASS statement so avisitn is now a continuous variable), and specify avisit in the REPEATED statement as only CLASS variable is allowed for the repeated effect.
Please note that adjust=dunnett implies that you are comparing trtn against the control, which by default is the first level of trtn. It does not do all pairwise comparisons for trtn. How many levels do yo have for trtn?
If you want to treat AVISITN as a classification variable, you might want to use the SLICE statement, but I am not sure if you will get exactly what you want. One way is to use --
slice trtn*avisitn / sliceby=avisitn adjust=dunnett;
This will give you comparisons of trtn against the control (which is the first level by default) for each level of avisitn. You will just need to look at the results for avisitn=4 and ingore others.
If you take out adjust=dunnett, you would get all comparisons of trtn for each level of avisitn. Then you will just examine the result for avisitn=4 and ignore others.
Please note that your request of adjust=dunnett and all comparisons of trtn against each other (regardless of avisitn value) does not go together. You cannot get both.
Another way of using the SLICE statement is to specify your CLASS statement as
Class USUBJID TRTN(ref="1") avisitn; *** avisitn is after trtn;
then use the SLICE statement such as --
slice trtn*avisitn / diff=control('1' '4') adjust=dunnett;
This will compare all trtn against the level '1' for just avisitn=4 with Dunnett adjusted p-values. You can change the reference level for trtn to something else, but again, you cannot get all pairwise comparisons for trtn (depending on how many levels of trtn you have, this might or might not matter).
If you still want all pairwise comparisons for trtn for just avisitn=4, then you might have to write ESTIMATE or LSMESTIMATE statements for that, but ADJUST=DUNNETT might not be available.
... View more