BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

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;
2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

q1) it is because you use the mean here:

height.mean/weight.mean;

q2) because mean is not calculated.

Ksharp
Super User

You are using " 

rbreak after/summarize;    

 

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 706 views
  • 0 likes
  • 3 in conversation