BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Dear

 

Please suggest me in my pgm how to calculate stratified p_value. The stratification factors are (age ss ph). Thank you

 

data one;
input trt res$ age ss ph $;
datalines;
1 cr 55 1 Y
1 cr 53 1 N
1 cri 52 1 Y
1 cri 58 1 N
1 cri 50 2 N
1 cr 53 2 N
1 cri 52 2 Y
1 cri 58 2 N
2 cri 56 2 Y
2 cri 51 2 N
2 cr 50 2 Y
2 cr 56 2 N
;

  proc freq data = one;
                                          table age*ss*ph*trt*res/ alpha = 0.05 chisq pdiff cl nocol nopercent ;
                                          exact chisq / alpha = 0.05 ;
                                          ods output chisq = exact (where = (upcase(statistic) = 'CHI-SQUARE')) ;
                                          output out = pval(rename = (p_pchi = pval)) pchi ;
                                  run ;
2 REPLIES 2
Ksharp
Super User


/*If it is high dimension contingency table ,I think you need calculated CMH statistic*/
proc freq data = one;
table age*ss*ph*trt*res/ alpha = 0.05 cmh ;
run ;


And better post it at Statistical Forum :
https://communities.sas.com/t5/Statistical-Procedures/bd-p/statistical_procedures
ballardw
Super User

Are you requesting stratification by Age (only) SS (only) and PH (only) for the TRT*RES? If so perhaps

proc freq data = one;
   table (age ss ph)*trt*res/ alpha = 0.05 chisq pdiff cl nocol nopercent ;
   exact chisq / alpha = 0.05 ;
   ods output chisq = exact (where = (upcase(statistic) = 'CHI-SQUARE')) ;
   output out = pval(rename = (p_pchi = pval)) pchi ;
run ;

You can group variables by role in Proc Freq table statements with ( )

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 392 views
  • 2 likes
  • 3 in conversation