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

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- How do i write code and output datasets that include quartiles and pva...

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 07-12-2023 03:08 PM
(360 views)

Hi, i'm doing a survival table for work and i'm having trouble with the syntax.

I'm trying to use PROC LIFETEST to produce quartiles and p values using a log rank test that is stratified by TRT (treatment) and loc (location). I'm using Kaplan-Meier estimates.

So far this is what i have, but it's not producing what i need. Can i receive some help?

```
ods output quartiles=a;
proc lifetest data= mydata method=pl;
time aval*cnsr(1);
strata trt loc / test=logrank;
run;
ods output close;
```

7 REPLIES 7

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

A bit old but possibly useful.

https://gist.github.com/statgeek/d3bce2a9e2ef0523db9d

Something else that may be useful:

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

```
/*
Maybe your dataset have problem.
Can you post your dataset?
I test your code with SASHELP.BMT,
and have no problem .
*/
proc lifetest data= sashelp.bmt method=pl;
time t*status(0);
strata group / test=logrank;
run;
```

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thanks, i think my set up is wrong as i'm trying to output p values.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi, you say:

So far this is what i have, but it's not producing what i need. Can i receive some help?

It sounds like your code is running without errors or warnings, is that correct? Can you say more about how the results you are producing differ from the results you need?

Check out the Boston Area SAS Users Group (BASUG) video archives: https://www.basug.org/videos.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

i was trying to produce p values and output them with homtests= dsnout option. There are 4 treatment groups, with the first 3 being active, and the last one being placebo.

The output was only producing one p value, even though i needed 3 since i'm comparing each group to placebo.

The output was only producing one p value, even though i needed 3 since i'm comparing each group to placebo.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Before worrying about output datasets, I would focus on getting the output results you want.

When you run the PROC LIFETEST step, do you see the p-values you want? When I run the step on sashelp.bmt, I get one p-value for a test of equality over strata. There are 3 groups, but I get one p-value testing overall homogeneity. Sounds like that's not what you want. After you figure out how to get the output results you want, it should be possible use ODS to write the results to an output dataset.

Check out the Boston Area SAS Users Group (BASUG) video archives: https://www.basug.org/videos.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I think the best option would probably be to do 3 separate tests with the 4 groups, and to use a WHERE statement for the following combos:

where trt in (1,4)

where trt in (2,4)

where trt in (3, 4)

1:3 being active groups,

4 being placebo

That would produce a p value for all the pairwise comparisons against placebo.

where trt in (1,4)

where trt in (2,4)

where trt in (3, 4)

1:3 being active groups,

4 being placebo

That would produce a p value for all the pairwise comparisons against placebo.

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

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.