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
- /
- Base SAS Programming
- /
- Summary table with p values

Topic Options

- 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
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-15-2015 01:48 AM

Hello all

Assume I have a dataset with 2 variables:

1) Group - character variable, with 3 levels: Treatment 1, Treatment 2 and Control.

2) Y - Numeric variable

I wish to product a summary statistics table, with mean, standard deviation and median for all 3 categories, which is easy, using PROC TABULATE. But, I also wish to have another column at the end, with p values of a t test comparing the means of the Treatment 1 vs. Control and Treatment 2 vs. Control. In other words, the last column, will have a missing value for the first row (can't compare control to itself), and two p values in the other two rows.

I did something, I wouldn't even upload the code, it is very very long and complicated. There must be an easy way of doing it. Can you assist me with some tips on how to do it gently and efficiently ?

Thank you !

Input (numbers are arbitrary):

ID | Group | X |
---|---|---|

1 | Control | 21 |

2 | Treatment 1 | 11 |

3 | Treatment 2 | 22 |

4 | Control | 23 |

Requested Output (numbers are arbitrary):

Variable | Mean | Standard Deviation | Median | P value |
---|---|---|---|---|

Control | 22 | 7 | 21 | |

Treatment 1 | 10 | 4 | 9 | 0.001 |

Treatment 2 | 20 | 5 | 17 | 0.785 |

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

Posted in reply to BlueNose

07-15-2015 04:25 AM

Hi,

Why not use proc means with output out=?

With regards to you requested output, I don't know what model you are using so guessing a bit. First, put:

ods trace on;

Before your model procedure and run it. This will print to the log each of the objects that are created by the model. Next, once you have highlighted the objects you want to use put:

ods output <object>=<dataset>;

This will create a dataset <dataset> with the data from <object>. Now that you have proc means output and the object output it is just a matter of merging the two together.

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

07-16-2015 04:20 AM

PROC MEANS will give me a t-test of each variable vs. 0, I wish to have a t-test of each variable vs. the control group.