BookmarkSubscribeRSS Feed
Melissa
Calcite | Level 5
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
4 REPLIES 4
Doc_Duke
Rhodochrosite | Level 12
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
pransh
Calcite | Level 5
hi can u help me out with the second question here
pransh
Calcite | Level 5
hi how did u solve the second question?
ballardw
Super User

@pransh wrote:
hi how did u solve the second question?

You are resurrecting a thread that is very old, more than 12 years old. You would be better off starting your own question. The original poster did not provide any example data so no solution is actually possible, just general guidelines.

 

Be prepared to provide example data in the form of a data step or reference use of one of the SAS supplied data sets like SASHELP.CLASS.

Ask your questions in terms of the data you reference.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1056 views
  • 0 likes
  • 4 in conversation