BookmarkSubscribeRSS Feed
BlueNose
Quartz | Level 8

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):

IDGroupX
1Control21
2Treatment 111
3Treatment 222
4Control23

Requested Output (numbers are arbitrary):

VariableMeanStandard DeviationMedianP value
Control22721
Treatment 110490.001
Treatment 2205170.785
2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

BlueNose
Quartz | Level 8

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 2 replies
  • 1409 views
  • 0 likes
  • 2 in conversation