Hi.

I am working on an analysis for research on premature baby health. I ran into a SAS coding issue which I hope some of you can help me with.

This is a repeated measures design. My outcome variable is SpO2. There are 20 subjects. Each subject has over 30,000 repeated measures (2 second intervals). The variables I have are ID, Time in seconds, and SpO2.

I have 1 million observations total. I would like to break this up into parts.

Instead of having observations for 2 second intervals, I would like to create hourly intervals. So I want to create one dataset that takes has the mean SpO2 for each hour for each subject. The dataset originally looks like this:

ID Seconds SpO2

1 0 100

1 2 99

1 4 100

...

But I want it to look like this:

ID Hours Mean_SpO2

1 0 98

1 1 100

1 2 99

...

I appreciate any help.

Thank you.

I am working on an analysis for research on premature baby health. I ran into a SAS coding issue which I hope some of you can help me with.

This is a repeated measures design. My outcome variable is SpO2. There are 20 subjects. Each subject has over 30,000 repeated measures (2 second intervals). The variables I have are ID, Time in seconds, and SpO2.

I have 1 million observations total. I would like to break this up into parts.

Instead of having observations for 2 second intervals, I would like to create hourly intervals. So I want to create one dataset that takes has the mean SpO2 for each hour for each subject. The dataset originally looks like this:

ID Seconds SpO2

1 0 100

1 2 99

1 4 100

...

But I want it to look like this:

ID Hours Mean_SpO2

1 0 98

1 1 100

1 2 99

...

I appreciate any help.

Thank you.

Last edited: