given dataset below, i want to compute the pooled sigma by Group. Already tried Ttest but it is limited to two class variables
| Group | COUNT | MEAN | SIGMA | MEAS_DATE |
| 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 |
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;
Assuming sigma is standard deviation and therefore variance I would look into PROC GLM.
PS. Stats questions are best posted under Statistical Procedure forum.
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;
Are you missing a set of parentheses? Seem like it should be
sqrt(sum((count-1)*sigma**2) / (sum(count)-count(*)))
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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.