BookmarkSubscribeRSS Feed
lone0708
Fluorite | Level 6

Hello all, 

This is probably very simple for someone used to use SAS. But i am interested in making a simple "survival curve" on my data. 

My dataset is containing information about prescriptions filled in a 6 months period. I have two groups i want to illustrate in the same plot. The first group in persons who did not fill a prescription in the first 10 weeks and the other group in persons who did fill a prescription.

 

data have;
input person_id week_of_use group
datalines;
1   3    1
1   3     1
1    7     1
2   11     2
3    8     1
3    12   1
4   23     2
5  2       1
6   13    2
6    14   2
6    20    2
6    23    2
;

I hope, you can help me

10 REPLIES 10
lone0708
Fluorite | Level 6

survivalcurve.jpg

WarrenKuhfeld
Ammonite | Level 13

https://support.sas.com/documentation/onlinedoc/stat/151/kaplan.pdf

 

Examples in this chapter start with the simple and continue to the complex.

lone0708
Fluorite | Level 6
@WarrenKuhfeld,
Thanks for your reply.
The problem for me is, that i do not understand the coding of status in my particular case, as all participants are contributing in all of the study period
Reeza
Super User

For survival analysis you need your data in the form of:

 

ID Duration Censor

How does that work for your data if all participants are available throughout the study? What is the time component that causes people to drop off?

Please explain your data and the graph you're trying to create. 

 


@lone0708 wrote:
@WarrenKuhfeld,
Thanks for your reply.
The problem for me is, that i do not understand the coding of status in my particular case, as all participants are contributing in all of the study period

 

lone0708
Fluorite | Level 6

Hi Reeza,
Thanks for your reply!
I can create a variable with duration of use, and I also have entering and end date of study period for all participants (not shown in the sample data). All participants have the same length of follow-up, but the entering and end dates are different for each person.
What should the censor variable contain?

I am sorry for my clumsiness. I am far from being a statistician……

Reeza
Super User

Why does one group start at a fixed number and drop off and one starts at nothing and grows?

 

lone0708
Fluorite | Level 6
It’s just how I expect the curve to look like.
After a certain event (entering date) some will not use any medication, but at some point (10 weeks after event) they will be more likely have a need for medication.
The other way around with the other group. They have an immediate need for medication right after the event, but will not need it with time.
I hope it makes sense
Reeza
Super User
Your censor variable tells you of the event of interest and if it's met. So what are you looking for the graph to tell you? How many patients were in the study and when they needed the medication? If so, the timepoint of when they started the medication and if they took the medication is your censor variable.
lone0708
Fluorite | Level 6
The purpose is to illustrate how many persons took/got a preacribtion x weeks from the entering date (which is different for every person).
Should the censoring variable then contain the date of end of follow-up?

Reeza
Super User
So duration is the time to start taking the drug or end of follow up from when they started.
Censor is if they took the drug, a 0/1.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 10 replies
  • 971 views
  • 0 likes
  • 3 in conversation