BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PaigeMiller
Diamond | Level 26

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:

 

Capture.PNG

 

How can I remove this blank header in PROC REPORT?

 

 

 

--
Paige Miller
1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

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;

 

Capture.PNG

View solution in original post

4 REPLIES 4
data_null__
Jade | Level 19

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;

 

Capture.PNG

PaigeMiller
Diamond | Level 26

@data_null__ wrote:

Strange but true.

 


Indeed. 

--
Paige Miller
data_null__
Jade | Level 19

@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.

 

Capture.PNG

 

Cynthia_sas
SAS Super FREQ

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:

alternate_report_header.png

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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 4 replies
  • 2557 views
  • 1 like
  • 3 in conversation