repeated measures - need to confirm sas code

i have a data set that includes repeated measurements on 50 subjects. for each subject, i have their gender, type of treatment received, and ecg over a 24-hour interval at baseline (0), day 5 and day 28.
for day 0 - each subject's ecg was measured at time 0, 1, 2,...,24 hours.
for day 5 and day 28 - each subject's ecg was measured at time 4, 8, 12, 16, 20, 24

this trial has a parallel design

so here's roughly what the data looks like:
subject trt gender day hour ecg
1 a f 0 1 398
1 a f 0 2 345
1 a f 28 24 412
50 b m 24 2.0 434

im trying to study the treatment difference (3 treatments including placebo) and not combine analysis for day 5 and 28.
ecg is the dependent variable. i'm taking gender, trt, day, hour as independent variables with gender, trt, day as discrete variables and hour as continuous.

im thinking my sas code to analyze this data should look something like the following:

proc mixed;
class sub trt day gender ;
model ecg=trt trt*day gender hour;
repeated/type=un/cs/etc subject=sub;

does the above code look acceptable? im confused because of the multiple ecg readings in a given day as opposed to a single reading and im not quite sure how to deal with this.

any input will be appreciated.
Last edited:
Did you find an answer?


Did you figure out the answer to this? I'm having a similar problem, with repeated measures over both day and year.

repeated measures

I did get help and I 'think' I understand how to tackle this issue now. Can you describe your dataset and tell me what you're trying to do so I don't give you unwanted information? :)

Thanks for replying and for being willing to help.

The dataset I was given consists of counts of birds flying past a radar station, on a given day in a given year. Each station corresponds to a study site. What we’d like to know is whether there are significant year and day effects on the number of birds observed flying past each station. The model would therefore look something like this:

IBijk = Yeari + Day(Yeari)j + Eijk

where IBijk = the number of Incoming Birds in year i on day j at site k. As you’ll note, there is no “treatment effect”, as this is simply a time-series analysis.

The tricky part is that the data are unbalanced: Not all sites were surveyed in all years, with some sites surveyed in more years than others. Likewise, not all sites were surveyed on the same day, with some sites surveyed on more days than others. Therefore, with missing data and unequal time intervals, my only option for analysis is a mixed model (ANOVA and GLM are out). Where I’m stuck is how to specify a day (i.e., Julian date) and year time period in the repeated statement (i.e., the “repeated-effect”). Right now I have:

PROC mixed DATA = dataset;
CLASS SiteName Year JulDay;
MODEL IB= Year JulDay(Year);
REPEATED <repeated-effect> /subject= SiteName type=un;

But I don’t know what to put in the <repeated-effect>.

Any thoughts would be much appreciated. Please let me know if you need more details.

Hi Jenn,

I think for your repeated effect you'd put julday as that's where your measurements are repeating.

For my program, my repeated statement looked like the following:
repeated hours/type=un sub=patient.

Let me know if this works. If need be, I'll dig through my class notes to see if I can find some more useful information for you.