BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
katemcguckin
Fluorite | Level 6

* katemcguckin40@gmail.com;

Hi. I have 60 patients with varying number of patient visits for treatment.
The variable definitions are listed below.
This is a repeated measures study in which there are 1666 observations among the 60 patients.


I also printed out just the first 6 patient data to keep it short.
My name is Kate. I am new to longitudinal analyses.

I hope someone can help me.


* variables:
id = subject id
dob=date of birth
q_visitdate = visit date for therapy
visits = visit number
diff_bg= difference between pre and post-treatment blood sugar
q_pre_gluc = sugar level before treatment
q_post_gluc = sugar level after treatment
q_oxytime = time they spent in the treatment
q_oxyconcent = oxygen concentration for each treatment
visits= visit number


What do I need to calculate?
1. Using the structure I have, I want to just get the mean of each person (id's)
(1) diff_bg (difference between pre- and post-treatment dugar levels) ,
(2) pre-gluc (pretreatment sugar level)
(3) post_gluc (post-treatment sugar level,
(4) q_oxytime

So if I went through 20 treatments, I want the mean of those 4 variables in (1). I tried the lag
function,and it did not work.

2. Using the structure I have (see attachment), I want to calculate the number of months or days between treatments
(It's not set up in the datalines to follow Cody's book)

3. To describe the change in sugar level differences, would I need to use the moving average of each person for analyses?
Or what would I use?

Thank you. Kate.

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Please post some example data in the form of a data step to get a code answer.

 

Do you have SAS/ETS? If so, moving averages are easily calculated with PROC EXPAND.

View solution in original post

3 REPLIES 3
katemcguckin
Fluorite | Level 6

It's Kate. 

 

I figured out how to get the means of each patient's variables that I wanted. 

 

But I want to calculate the time in days between visits. 

 

If you can help and if anyone is out there, please refer to the attachment on the first email. 

 

Thank you, kindly.  Kate

katemcguckin
Fluorite | Level 6

I figured out the times between treatments. 

 

Is anyone getting these ?s.... if so, let me know. Usually people respond. I have had no responses.  

PeterClemmensen
Tourmaline | Level 20

Please post some example data in the form of a data step to get a code answer.

 

Do you have SAS/ETS? If so, moving averages are easily calculated with PROC EXPAND.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1343 views
  • 0 likes
  • 2 in conversation