turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Programming Help

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-01-2010 11:53 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-01-2010 03:18 PM

Melissa,

First, before we take this too far, make sure your professor is OK with going outside for help. I teach intro biostat and would allow it, but would also want to know about it.

Some things that I can say that would point you in the right direction.

The professor is expecting you to answer this question using the DATA step, not PROC MEANS (the hint to use FIRST. and LAST. tell you that, as they only exist in the DATA step).

To use FIRST. and LAST. require that the data be sorted (like you had to do for the first part of the problem) and the use of the BY statement in the DATA step.

You will also need to use an OUTPUT statement (or two) connected to IF statements that determine which record is needed in the final data set.

Doc Muhlbaier

Duke

First, before we take this too far, make sure your professor is OK with going outside for help. I teach intro biostat and would allow it, but would also want to know about it.

Some things that I can say that would point you in the right direction.

The professor is expecting you to answer this question using the DATA step, not PROC MEANS (the hint to use FIRST. and LAST. tell you that, as they only exist in the DATA step).

To use FIRST. and LAST. require that the data be sorted (like you had to do for the first part of the problem) and the use of the BY statement in the DATA step.

You will also need to use an OUTPUT statement (or two) connected to IF statements that determine which record is needed in the final data set.

Doc Muhlbaier

Duke