1.
proc means sum data = one nway noprint;
class x y;
var a;
output out = two;
run;
2.
proc means mean data = one nway noprint;
class x y;
var a;
output out = two;
run;
3.
proc means data = one nway noprint;
class x y;
var a
output out = two;
run;
I can't see any different among 1,2 and 3,they are same. but why?
Thanks
yes, I noticed the red color parts.
The color parts have effect only on the print out. You couldn’t see the effect because you used noprint.
proc means sum data = sashelp.class nway ;
class sex;
var age;
output out = two ;
run;
The MEANS Procedure
Analysis Variable : Age
N
Sex Obs Sum
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
F 9 119.0000000
M 10 134.0000000
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
/*2.*/
proc means mean data = sashelp.class nway ;
class sex;
var age;
output out = two2;
The MEANS Procedure
Analysis Variable : Age
N
Sex Obs Mean
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
F 9 13.2222222
M 10 13.4000000
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
run;
If you want to see the effect on the output datasets, you need to add sum, mean to the output statement.
proc means data = sashelp.class nway noprint;
class sex;
var age;
output out = two1 sum= ;
run;
/*2.*/
proc means data = sashelp.class nway noprint;
class sex;
var age;
output out = two2 mean=;
run;
Message was edited by: Linlin
Hi:
You control what gets written to the output data set (OUTPUT OUT= file) by listing the statistics & variables on the OUTPUT statement. Without any other instructions from you, you will always get the same 5 statistics: N, MEAN, MIN, MAX, STD.
Look in the PROC MEANS documentation for examples of specifying the statistics you want, with the names you want on the OUTPUT statement.
cynthia
Thank you Cynthia,
I looked into the means document:please see the red color blow, in my question the statistics-keywords 'sum' and 'mean' don't have any effect,why?
PROC MEANS <option(s)> <statistic-keyword(s)>; BY <DESCENDING> variable-1 <... <DESCENDING> variable-n><NOTSORTED>;
CLASS variable(s) </ option(s)>;
FREQ variable;
ID variable(s);
OUTPUT <OUT=SAS-data-set> <output-statistic-specification(s)>
<id-group-specification(s)> <maximum-id-specification(s)>
<minimum-id-specification(s)> </ option(s)> ;
TYPES request(s);
VAR variable(s) < / WEIGHT=weight-variable>;
WAYS list;
WEIGHT variable;
The example is:
/*1*/
proc means sum data = sashelp.class nway noprint;
class sex;
var age;
output out = two1;
run;
/*2.*/
proc means mean data = sashelp.class nway noprint;
class sex;
var age;
output out = two2;
run;
why two1 and two2 are same?
Thanks!
If you want to see the difference, you need to put the statistics in output statement.
/* 1 */
proc means data = sashelp.class nway noprint;
class sex;
var age;
output out = two1 sum= ;
run;
/*2.*/
proc means data = sashelp.class nway noprint;
class sex;
var age;
output out = two2 mean=;
run;
/*3*/
proc means data = sashelp.class nway noprint;
class sex;
var age;
output out = two3;
run;
and you will see the difference if you take out the noprint in your code.
proc means sum data = one nway /*noprint*/;
class x y;
var a;
output out = two;
run;
2.
proc means mean data = one nway /*noprint*/;
class x y;
var a;
output out = two;
run;
3.
proc means data = one nway /*noprint*/;
class x y;
var a
output out = two;
run;
Thank you LinLin, please notice the red part.
I didn't see any difference for 1,2 and 3.
Do the red color parts have no any effect?
I revised your example as follow,the three results are identical,why? It seems the sum and mean in the proc statement don't have any effect.
/*1*/
proc means sum data = sashelp.class nway noprint;
class sex;
var age;
output out = two1;
run;
/*2.*/
proc means mean data = sashelp.class nway noprint;
class sex;
var age;
output out = two2;
run;
/*3*/
proc means data = sashelp.class nway noprint;
class sex;
var age;
output out = two3;
run;
yes, I noticed the red color parts.
The color parts have effect only on the print out. You couldn’t see the effect because you used noprint.
proc means sum data = sashelp.class nway ;
class sex;
var age;
output out = two ;
run;
The MEANS Procedure
Analysis Variable : Age
N
Sex Obs Sum
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
F 9 119.0000000
M 10 134.0000000
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
/*2.*/
proc means mean data = sashelp.class nway ;
class sex;
var age;
output out = two2;
The MEANS Procedure
Analysis Variable : Age
N
Sex Obs Mean
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
F 9 13.2222222
M 10 13.4000000
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
run;
If you want to see the effect on the output datasets, you need to add sum, mean to the output statement.
proc means data = sashelp.class nway noprint;
class sex;
var age;
output out = two1 sum= ;
run;
/*2.*/
proc means data = sashelp.class nway noprint;
class sex;
var age;
output out = two2 mean=;
run;
Message was edited by: Linlin
The red part only is used to display at output window which will not write into output dataset.
So your output dataset will always be the same.
Ksharp
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: