I have been struggling with a homework assignment for my SAS programming class. I have already done parts of it, but cannot do the end of it without figuring out one part.
The data is the following:
Each follow-up visit is represented as one record in the data set. Variables in the file are:
1. Patient id (1-50) ~ called id
3. Visit number, numbered consecutively for each subject ~ called visit
4. Time since last visit (months, with 0 at the first visit) ~ called time
5. Stage of disease (0 = early stage, and 1 = after disease progression) ~ called stage
I added a variable called tottime using this instruction:
2. Keeping data in a one row for each visit format, create a variable giving the number of months between the entry into the study for that subject and that study visit. (This will give the total number of months on study at each visit). PROC PRINT (e.g., the first 20 observations) a partial listing of the data to make sure that this new variable was created correctly
But I am now struggling with this instruction:
3. For analysis, we would like a data set with one row per subject. As part of this data set, we want a variable that gives the length of time that the subject was in the study before disease progression. For patients whose disease does not progress during the study, this would be their total time from visit 1 until the last visit. For subjects whose disease progresses during the study, we take this to be the time from visit 1 until the first visit where stage of disease is 1. (Hint: to create this variable, you should use the variable created in part B, and use the first. and last. commands. This is tricky and you may need to try this a few different ways before you find one that works. To be sure that you have it right, check your results on a few subjects who progress and a few who do not.) For each subject, only keep the id number, treatment group, follow-up time, and whether disease has progressed.
I think my professor would like us to use the proc means statement to output to a one line per subject dataset.
Any help/suggestions/nudges in the right direction would be much appreciated!
Thanks,
Melissa