Programming the statistical procedures from SAS

What Proc to get descriptive statistics and test mean median differences?

Reply
Occasional Contributor
Posts: 12

What Proc to get descriptive statistics and test mean median differences?

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!

Respected Advisor
Posts: 2,655

Re: What Proc to get descriptive statistics and test mean median differences?

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

Ask a Question
Discussion stats
  • 1 reply
  • 142 views
  • 0 likes
  • 2 in conversation