Statistical Procedures

Programming the statistical procedures from SAS
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MaryA_Marion
Lapis Lazuli | Level 10

I have entered a contingency table. How to compute z statistic to test p1=p2 (two independent proportions) in SAS. What procedure should I use. I don't seem to find it in proc freq output. How should I determine whether or not to pool when computing the standard error?

data seatbelts;
input seatbelt $ injury $ count;
cards;
no yes 1601
no no 162000
yes yes 510
yes no 412000
;
ods graphics on;
ods exclude FishersExact;
proc freq data = seatbelts order=data ;
weight count;
tables seatbelt*injury/norow nocol nopercent expected chisq relrisk riskdiff alpha = .05;
run;
1 ACCEPTED SOLUTION
2 REPLIES 2
MaryA_Marion
Lapis Lazuli | Level 10

Looking up riskdiff in proc freq opened up all sorts of topics. I am staying with the very simple hypothesis test of P1 = P2 where under Ho p1=p2. I wrote a macro to do what I'm looking for in the SAS output. Please see the attached file.

 

With all the different options I settled upon the following tables statement:

tables race*party/norow nocol nopercent expected chisq relrisk riskdiff(equal var = null cl=wald) alpha = .05;

 

Am I saying  that I'm assuming equal variances of the two proportions in "equal var=null"? I am avoiding the very complicated discussions seeing in the users guide and trying to do just the basic test of equal proportions at this time. We can pool or use individual variances in the denominator of the z statistic. Further I would like to clarify and be sure of the syntax for cl=wald and cl=score when using the equal var=null statement. 

 

I find I need to code what I think SAS is outputting to verify. Finally, are equations for z, confidence interval limits for z etc. listed somewhere in the proc freq users guide?

sas-innovate-white.png

Join us for our biggest event of the year!

Four days of inspiring keynotes, product reveals, hands-on learning opportunities, deep-dive demos, and peer-led breakouts. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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