# Urgent: Howto Calculate Variance and Mean in SAS

#### Euroman

##### New Member
Hi

I this SAS document and has some trouble with it

I would SAS to calculate the means, variance for three cases then site = 0, sit = 15 and site = 30.

But I can only get it to calculate the mean. What am I doing wrong?

Sincerely Alfred

Code

Title 'Consentration';
OPTIONS ls = 85;

data concentration;
input dist drain site@@;
datalines;
2.15 250 0 2.54 250 0 2.15 250 0 2.11 250 0
1.90 250 0 2.40 250 0 2.23 250 0 2.54 250 0
2.11 250 0 2.04 250 0
1.90 1300 0 2.40 1300 0 2.40 1300 0 1.85 1300 0
2.54 1300 0 2.11 1300 0 2.04 1300 0 1.90 1300 0
2.11 1300 0 2.40 1300 0
1.90 250 15 2.54 250 15 2.11 250 15 1.90 250 15
2.11 250 15 1.70 250 15
2.23 250 15 2.11 250 15 1.70 250 15 2.11 250 15
2.11 1300 15 1.90 1300 15 2.11 1300 15 2.40 1300 15
2.11 1300 15 1.70 1300 15 1.90 1300 15 2.11 1300 15
2.15 1300 15 2.23 1300 15 2.11 250 30 2.04 250 30
1.90 250 30 2.11 250 30 2.15 250 30 1.54 250 30
1.85 250 30 1.54 250 30 1.95 250 30 1.90 250 30
2.11 1300 30 1.70 1300 30 2.23 1300 30 2.11 1300 30
1.70 1300 30 2.54 1300 30 1.85 1300 30 1.70 1300 30
2.11 1300 30 1.90 1300 30
run;
proc sort;
by dist;
site drain;
run;
proc means;
variables site drain;
by dist;
run;
proc anova;
class dist drain site;
model site = drain;
run;
proc print;
run;

##### New Member
Hi

I this SAS document and has some trouble with it

I would SAS to calculate the means, variance for three cases then site = 0, sit = 15 and site = 30.

But I can only get it to calculate the mean. What am I doing wrong?

Sincerely Alfred

Code

Title 'Consentration';
OPTIONS ls = 85;

data concentration;
input dist drain site@@;
datalines;
2.15 250 0 2.54 250 0 2.15 250 0 2.11 250 0
1.90 250 0 2.40 250 0 2.23 250 0 2.54 250 0
2.11 250 0 2.04 250 0
1.90 1300 0 2.40 1300 0 2.40 1300 0 1.85 1300 0
2.54 1300 0 2.11 1300 0 2.04 1300 0 1.90 1300 0
2.11 1300 0 2.40 1300 0
1.90 250 15 2.54 250 15 2.11 250 15 1.90 250 15
2.11 250 15 1.70 250 15
2.23 250 15 2.11 250 15 1.70 250 15 2.11 250 15
2.11 1300 15 1.90 1300 15 2.11 1300 15 2.40 1300 15
2.11 1300 15 1.70 1300 15 1.90 1300 15 2.11 1300 15
2.15 1300 15 2.23 1300 15 2.11 250 30 2.04 250 30
1.90 250 30 2.11 250 30 2.15 250 30 1.54 250 30
1.85 250 30 1.54 250 30 1.95 250 30 1.90 250 30
2.11 1300 30 1.70 1300 30 2.23 1300 30 2.11 1300 30
1.70 1300 30 2.54 1300 30 1.85 1300 30 1.70 1300 30
2.11 1300 30 1.90 1300 30
run;
proc sort;
by dist;
site drain;
run;
proc means stddev;
variables site drain;
by dist;
run;
proc anova;
class dist drain site;
model site = drain;
run;
proc print;
run;
You need to add the option stddev on the proc means line...otherwise the program will only get the means.