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
- /
- General Programming
- /
- Percentage survive rates EXAMPLE

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-20-2016 09:01 AM

Good morning SAS friends:

I was looking for examples to try programming this but i could not find any clue, here is the example:

DAM | animal_birth_survival_rate | W30D | W90D |

1 | 1 | 23 | 30 |

2 | 1 | 22 | 32 |

3 | 1 | 23 | 31 |

4 | 1 | 23 | 33 |

5 | 0 | . | . |

6 | 1 | 24 | 33 |

7 | 1 | 25 | 32 |

8 | 1 | . | . |

9 | 0 | . | . |

10 | 0 | . | . |

11 | 1 | 22 | 30 |

12 | 1 | 22 | . |

13 | 1 | 25 | 34 |

14 | 1 | 26 | 32 |

15 | 0 | . | . |

16 | 1 | 23 | 32 |

17 | 1 | 25 | 32 |

18 | 1 | . | . |

19 | 0 | . | . |

20 | 0 | . | . |

I have the complete growing information of 20 diferent animals born from 20 diferent DAMS (examples associated to animal breedeing modeling) so i need to obtain the survival RATES:

As we can see 70% of the newborns are alive and the rest 30% is death (due enviroment and genetic reasons) so on, each animal has a weight record the first 1 is WEIGHT AT 30 DAYS, and the second one is WEIGHT AT 90 DAYS, so we need to measute the survival rate at 30 days and survival rate at 90 days to obtaining a table like this:

DAM | animal_birth_survival_rate | W30D | survival_rate_30_days | W90D | survival_rate_90_days | total_survival_birht_90_days |

1 | 1 | 23 | 1 | 30 | 1 | 1 |

2 | 1 | 22 | 1 | 32 | 1 | 1 |

3 | 1 | 23 | 1 | 31 | 1 | 1 |

4 | 1 | 23 | 1 | 33 | 1 | 1 |

5 | 0 | . | . | . | . | 0 |

6 | 1 | 24 | 1 | 33 | 1 | 1 |

7 | 1 | 25 | 1 | 32 | 1 | 1 |

8 | 1 | . | 0 | . | . | 0 |

9 | 0 | . | . | . | . | 0 |

10 | 0 | . | . | . | . | 0 |

11 | 1 | 22 | 1 | 30 | 1 | 1 |

12 | 1 | 22 | 1 | . | 0 | 0 |

13 | 1 | 25 | 1 | 34 | 1 | 1 |

14 | 1 | 26 | 1 | 32 | 1 | 1 |

15 | 0 | . | . | . | . | 0 |

16 | 1 | 23 | 1 | 32 | 1 | 1 |

17 | 1 | 25 | 1 | 32 | 1 | 1 |

18 | 1 | . | 0 | . | . | 0 |

19 | 0 | . | . | . | . | 0 |

20 | 0 | . | . | . | . | 0 |

To explain this: i will take the animal 1, 5, 8 and 12:

The Animal 1 survived at 30 days and 90 days, it is observed because he has the measurements at this ages:

The Animal 5 born death, so he has nos the other measurements, therefore in the respective column have to be filled with an "point" (".") like a lost observation.

The Animal 8 Born alive but he has not his respective measurement at 30 dyas, it is informing that the animal died in this time interval, thus hes survival rate will be 0.

and The animal 12 born alive, he survived to 30 days, with his respective measurement, but he didnt survive at 90 days, because he has not its measurement at this day. so his value to survive will be 0.

I would like to give the importance to the "lost observations", this because in this example we will not just find the survival rate at this ages, i woul like to find thetotal_survival_birht_90_days,

20 lambs born -> 70% alive and 30% death -> later on at 90 days we can find 11 lamb alive and 9 death little by little in their respective time intervals. we left 55% lambs alive and 45% lambs death from birth to 90 days.

Hoping to be helped

Kig regards

Accepted Solutions

Solution

04-20-2016
02:01 PM

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

04-20-2016 02:00 PM

The first time i applied i learn from you my friends

thanks a lot

data want;

set have;

BIRHT_SURVIVAL_RATE = ANIMAL_BIRTH_SURVIVAL_RATE;

IF BIRHT_SURVIVAL_RATE = 1 and W30D > 0.1 then SURVIVAL_RATE_30_DAYS = 1;

else if BIRHT_SURVIVAL_RATE = 1 and W30D = "." then SURVIVAL_RATE_30_DAYS = 0;

IF SURVIVAL_RATE_30_DAYS = 1 and W90D > 0.1 then SURVIVAL_RATE_90_DAYS = 1;

else if SURVIVAL_RATE_30_DAYS = 1 and W90D = "." then SURVIVAL_RATE_90_DAYS = 0;

IF BIRHT_SURVIVAL_RATE = 1 and W90D > 0.1 then TOTAL_SURVIVAL_0_90_DAYS = 1;

else if BIRHT_SURVIVAL_RATE = 1 and W90D = "." then TOTAL_SURVIVAL_0_90_DAYS = 0;

else if BIRHT_SURVIVAL_RATE = 0 and W90D = "." then TOTAL_SURVIVAL_0_90_DAYS = 0;

RUN;

All Replies

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

04-20-2016 09:09 AM

Wouldn't this be proc lifetest?

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

04-20-2016 11:03 AM

Reeza good afternoon:

I saw the programing of PROC lifetest and i coudl not complete it.

Could you help me to acomplish this Result please??

Thanks

I saw the programing of PROC lifetest and i coudl not complete it.

Could you help me to acomplish this Result please??

Thanks

Solution

04-20-2016
02:01 PM

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

04-20-2016 02:00 PM

The first time i applied i learn from you my friends

thanks a lot

data want;

set have;

BIRHT_SURVIVAL_RATE = ANIMAL_BIRTH_SURVIVAL_RATE;

IF BIRHT_SURVIVAL_RATE = 1 and W30D > 0.1 then SURVIVAL_RATE_30_DAYS = 1;

else if BIRHT_SURVIVAL_RATE = 1 and W30D = "." then SURVIVAL_RATE_30_DAYS = 0;

IF SURVIVAL_RATE_30_DAYS = 1 and W90D > 0.1 then SURVIVAL_RATE_90_DAYS = 1;

else if SURVIVAL_RATE_30_DAYS = 1 and W90D = "." then SURVIVAL_RATE_90_DAYS = 0;

IF BIRHT_SURVIVAL_RATE = 1 and W90D > 0.1 then TOTAL_SURVIVAL_0_90_DAYS = 1;

else if BIRHT_SURVIVAL_RATE = 1 and W90D = "." then TOTAL_SURVIVAL_0_90_DAYS = 0;

else if BIRHT_SURVIVAL_RATE = 0 and W90D = "." then TOTAL_SURVIVAL_0_90_DAYS = 0;

RUN;