Help using Base SAS procedures

calculate pooled sigma

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

calculate pooled sigma

given dataset below, i want to compute the pooled sigma by Group. Already tried Ttest but it is limited to two class variables

GroupCOUNTMEANSIGMAMEAS_DATE
a501101.166412.6279214-Apr-15
a123103.3310.5458-Apr-15
b16499.2107116.147058-Apr-15
b69786.242669.7949899-Apr-15
c22382.227.4227-Apr-15
c78084.100398.9135458-Apr-15

Accepted Solutions
Solution
‎05-22-2015 04:15 PM
Trusted Advisor
Posts: 1,204

Re: calculate pooled sigma

Thanks Dr. Rick - Yes, we need one extra set of parentheses to formulate this correctly.

proc sql;

select *,sqrt(sum((count-1)*sigma**2) / (sum(count)-count(*))) as pool_sigma from have

group by group;

quit;

View solution in original post


All Replies
Super User
Posts: 17,780

Re: calculate pooled sigma

Assuming sigma is standard deviation and therefore variance I would look into PROC GLM.

PS. Stats questions are best posted under Statistical Procedure forum.

Trusted Advisor
Posts: 1,204

Re: calculate pooled sigma

data have;

input Group $ COUNT MEAN SIGMA MEAS_DATE :anydtdte.;

format meas_date ddmmyy8.;

datalines;

a 501 101.1664 12.62792 14-Apr-15

a 123 103.33 10.545 8-Apr-15

b 164 99.21071 16.14705 8-Apr-15

b 697 86.24266 9.794989 9-Apr-15

c 223 82.22 7.422 7-Apr-15

c 780 84.10039 8.913545 8-Apr-15

;

proc sql;

select *,sqrt(sum((count-1)*sigma**2)/sum(count)-count(*)) as pool_sigma from have

group by group;

quit;

SAS Super FREQ
Posts: 3,475

Re: calculate pooled sigma

Are you missing a set of parentheses?  Seem like it should be

sqrt(sum((count-1)*sigma**2) / (sum(count)-count(*)))

Pooled variance - Wikipedia, the free encyclopedia

Solution
‎05-22-2015 04:15 PM
Trusted Advisor
Posts: 1,204

Re: calculate pooled sigma

Thanks Dr. Rick - Yes, we need one extra set of parentheses to formulate this correctly.

proc sql;

select *,sqrt(sum((count-1)*sigma**2) / (sum(count)-count(*))) as pool_sigma from have

group by group;

quit;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 289 views
  • 0 likes
  • 4 in conversation