Hello
Please see examples of proc report with "computed" column.
I have some questions related to example1 /example2 please:
Why do we use "analysis mean"? It is not calculating mean here.It just show the values.
I have some questions related to example3 please:
Why the total row is not calculated here?
/*Example1*/
proc report data=sashelp.class NOWD;
Columns name sex age height weight ratio;
DEFINE name / display "Name" width=10;
DEFINE sex / display "Gender" width=6;
DEFINE age / display "Age" width=4;
DEFINE height / analysis mean "Height" format=8.1;
DEFINE weight / analysis mean "Weight" format=8.1;
Define ratio /computed format=6.2;
compute ratio;
ratio=height.mean/weight.mean;
endcomp;
rbreak after/summarize;
run;
/*Example2*/
proc report data=sashelp.class NOWD;
Columns name sex age height weight ratio;
DEFINE name / display "Name" width=10;
DEFINE sex / display "Gender" width=6;
DEFINE age / display "Age" width=4;
DEFINE height / analysis mean "Height" format=8.1;
DEFINE weight / analysis mean "Weight" format=8.1;
Define ratio /computed format=6.2;
compute ratio;
ratio=_C4_/_C5_;
endcomp;
rbreak after/summarize;
run;
/*Example3*/
proc report data=sashelp.class NOWD;
Columns name sex age height weight ratio;
DEFINE name / display "Name" width=10;
DEFINE sex / display "Gender" width=6;
DEFINE age / display "Age" width=4;
DEFINE height / display "Height" format=8.1;
DEFINE weight / display "Weight" format=8.1;
Define ratio /computed format=6.2;
compute ratio;
ratio=_C4_/_C5_;
endcomp;
rbreak after/summarize;
run;
q1) it is because you use the mean here:
height.mean/weight.mean;
q2) because mean is not calculated.
You are using "
rbreak after/summarize;
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.