BookmarkSubscribeRSS Feed
lavernal
Calcite | Level 5

Hi, I am relatively new to SAS and I have a question on what Proc should I use.

I have a dataset that is categorized by two classes, e.g. Scenarios A,B,C and also Status Active Inactive. I hope to create a table where I can get the mean, median, s.d.,min,max for each category and also to test the differences in both mean and median between Status Active and Inactive for each of the Scenarios A,B,C I mean something below:

Test for Difference between Active and Inactive samples

                                   t-statistic                         Wilcoxon Z

Scenario A                       2,2**                                  2.8**

Scenario B                       3.1***                                 2.1**

I know I can use the proc means to get the descriptive statistics that I want, but after reading the guide, Im not sure how to proceed to get the mean and median difference test. Must I separate my dataset into 3 dataset based on the 3 scenarios and then run proc ttest and proc npar1way for each of the 3 sub datasets? Or is there a better way that I can use for the combined dataset and generate the desired table format?

Thank you in advance for any help offered!

1 REPLY 1
SteveDenham
Jade | Level 19

Look at PROC TTEST and PROC NPAR1WAY.  Use by group processing.  First sort your dataset by scenarios.  Then, as an example, try:

proc npar1way data=yourdataset median;

by scenario;

class status;

var response;

run;

A similar setup can be used for proc ttest:

proc ttest data=yourdataset;

by scenario;

class status;

var response;

run;

Good luck.

Steve Denham

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1135 views
  • 0 likes
  • 2 in conversation