## Help with longitudinal data - I have Cody's book, but I can't get what I need to work.

Occasional Contributor
Posts: 12

# Help with longitudinal data - I have Cody's book, but I can't get what I need to work.

* 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.

1. 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)
2. 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?

The attachment did not go through (don't know why) but I copied several IDs with their values.

I apologize for the variables not being in straight columns.

What kind of attachments am I allowed? I tried .doc  .lst

Kate

Super User
Posts: 2,516

## Re: Help with longitudinal data - I have Cody's book, but I can't get what I need to work.

Flagged as spam to remove duplicates.

Occasional Contributor
Posts: 12

## Re: Help with longitudinal data - I have Cody's book, but I can't get what I need to work.

Thank you.  I figured it out and went to Cody's website and used his code!

Discussion stats
• 2 replies
• 29 views
• 0 likes
• 2 in conversation