BookmarkSubscribeRSS Feed
aska_ujita
Obsidian | Level 7

Hi there, I have a data with two treatments (treated and control group).

 

I have behavioral class (Adequate, Calm, Very calm, Restless and Very restless) and its percentage in each group .

I did the proc freq and would like to compare the percentage frequency between group in each score.

 

My table is like this: 

ClassScoreTreatmentTreatmentP-value
  TREATED (%)CONTROL (%) 
Adequate16.9 to 21.20.0011.11 
Restless21.3 to 25.6 0.006.35 
Calm12.5 to 16.8 5.569.52 
Very calm≤ 12.494.4473.02 
Very restless≥ 25.70,000,00 

 

I would like to calculate the P-value.

 

Is there a way to do that?

 

Thank you.

4 REPLIES 4
ballardw
Super User

p-value implies a test. What test do you want to perform?

 

 

aska_ujita
Obsidian | Level 7

Hi Ballardw, thank you for helping me.

 

I would like to perform a t-test, thank you!

FreelanceReinh
Jade | Level 19

@aska_ujita wrote:

I would like to perform a t-test, thank you!


Hi @aska_ujita,

A two-sample t-test (see PROC TTEST documentation) compares the means of a continuous variable in two groups. So, not the percentages of the classified scores, but the original scores might be amenable to this test (especially if their distributions in the two treatment groups are approximately normal with similar variances). As a minimum for computing the test statistic you would need N (number of non-missing values), mean and standard deviation (or variance) per treatment group.

 

If only the classified scores are available, you can use a chi-square test or (in particular for small samples) Fisher's exact test for a comparison of the two frequency distributions (test of homogeneity). Both are available in PROC FREQ. I would not report p-values for comparisons of individual categories (unless these comparisons were pre-planned, with precautions for multiple testing). To assess the contribution of each category to the overall chi-square statistic, you can use the CELLCHI2 option of the TABLES statement, as shown in the code below:

/* Create sample data for demonstration */

data have;
do trt='treated','control';
  do class=1 to 5;
    input n @@;
    output;
  end;
end;
cards;
238 14 0 0 0
184 24 28 16 0
;

proc freq data=have;
weight n;
tables trt*class / chisq cellchi2 fisher;
run;

 

If you hypothesize a location shift in the distribution of scores in the treated vs. control group, a Wilcoxon rank-sum test would be a more specific approach. This test is available in PROC NPAR1WAY. Here's a code example for the above input dataset HAVE:

proc npar1way data=have wilcoxon plots=none;
class trt;
freq n;
var class;
run;
PaigeMiller
Diamond | Level 26

@aska_ujita wrote:

Hi Ballardw, thank you for helping me.

 

I would like to perform a t-test, thank you!


I think @ballardw wanted you to state exactly what hypothesis you want to test.

--
Paige Miller

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 586 views
  • 0 likes
  • 4 in conversation