Is it possible to remove the blank header shown below?
The starting code I use:
title "Mean Weight by Gender and Age";
proc report data=sashelp.class;
columns age sex,weight;
define age/group;
define sex/across;
define weight/analysis mean;
run;
But I don't need the word Weight in the table (twice), as it is explained clearly in the title above the table.
So, I do this, and I get a blank header where the words Weight used to be.
title "Mean Weight by Gender and Age";
proc report data=sashelp.class;
columns age sex,weight;
define age/group;
define sex/across;
define weight/analysis mean ' ';
run;
And the table, showing the blank header:
How can I remove this blank header in PROC REPORT?
Strange but true.
columns age WEIGHT,sex;
title "Mean Weight by Gender and Age";
proc report data=sashelp.class;
columns age weight,sex;
define age/group;
define sex/across;
define weight/analysis mean ' ';
run;
Strange but true.
columns age WEIGHT,sex;
title "Mean Weight by Gender and Age";
proc report data=sashelp.class;
columns age weight,sex;
define age/group;
define sex/across;
define weight/analysis mean ' ';
run;
@PaigeMiller wrote:
@data_null__ wrote:
Strange but true.
Indeed.
If you let the label for weight be displayed it will give insight into how/why it works.
Hi:
And, for completeness, an alternate way to take care of that blank space for Weight, without changing the order of your ACROSS items (which sometimes can be tricky), is to move the column header for AGE up into the COLUMN statement, and then blank it out on the DEFINE statment as shown below:
What happens here is that if you move AGE up to the same row where the F and M will be placed, then there is an entirely empty row underneath the Age, the F and the M and so when PROC REPORT detects that the entire row is blank, it doesn't show that row. Note that the COLUMN statement still has Sex, Weight and has a blank for the label of Weight, but now also has a blank for the Age label.
Hope this helps,
Cynthia
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.