BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

Hello

I want to print in proc report only rows with BMI between 19 and 21

What  is the way to do it?

proc report data=sashelp.class nowd;  
column name weight height BMI; 
define name / display; 
define weight / display; 
define height / display;
define bmi / computed format=4.1 'BMI';  
compute bmi;    
bmi = weight/(height*height)*703;
endcomp;  
run;

 

 

 

6 REPLIES 6
Kurt_Bremser
Super User

Apply the same formula in a WHERE= dataset option or a WHERE statement.

proc report
  data=sashelp.class (where=(19 le weight/(height*height)*703 le 21))
  nowd
;

 

Ronein
Meteorite | Level 14

Thanks,

Is there a way to perform it with related to the computed column ?

In complicated cases the  computed column is not simple calculation and then it will be difficult to apply it in such way 

Ronein
Meteorite | Level 14
How can I ask her?
Cynthia_sas
SAS Super FREQ
Hi:
Unfortunately, PROC REPORT will not do what you want to do. When you are computing a column, the report row is already built and the other columns populated, so you're asking PROC REPORT to both build the report row and then suppress the same report row based on the value of the computed column.
@Kurt_Bremser's solution to use a WHERE or to pre-process the data in a DATA step before the PROC REPORT step are the only solutions in this case.
Cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1250 views
  • 0 likes
  • 3 in conversation