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

I'm using 9.4 and the output is pdf. In the first example I want the "Outcomes" to span and center over the first two columns. My code is

 

PROC REPORT DATA =NEW_BORN_METRICS nowd spanrows
	style(report)=[rules=all] 
	style(header)=[rules=all cellheight=.6in font_size=1 background=lightgrey]
	style(column)=[font_size=1];
/*	COLUMN ('Outcomes' (Question  Response total_cases Total_Per)) ;*/
/*	COLUMN ('Outcomes' (Question  Response) (total_cases Total_Per)) ;*/
	COLUMN ('Outcomes' (Question  Response)) total_cases Total_Per ;
/*	COLUMN Question  Response total_cases Total_Per;*/
	DEFINE Question/ GROUP '' center;
	DEFINE Response/ '';
	DEFINE total_cases/  format=6. "Total Cases" center;
	DEFINE Total_Per/ format=percent8.1 "% of Total" center;
RUN;

 

 

Outcomes   Total Cases % of Total
# of Newborns per Admission Single birth 209 99.1%
  Twins 2 0.9%
Gestational Age at Delivery <=28 weeks 2 1.0%
  >=29 weeks and <=36 weeks 7 3.3%
  >=37 weeks 201 95.7%
NICU Stay? No 197 92.9%
  Yes 15 7.1%
Newborn Birth Weight LBW 1500-2499 Gm (3.31 lbs-5.5 lbs) 5 2.4%
  NBW >= 2500 Gm 204 97.1%
  VLBW 500-1499 Gm (1.1 lbs-3.3 lbs) 1 0.5%

 

Besides the example above the closest I could get was this but now I have an extra row over "Total Cases" and "% of Total"

Outcomes  
Total Cases % of Total
# of Newborns per Admission Single birth 209 99.1%
  Twins 2 0.9%
Gestational Age at Delivery <=28 weeks 2 1.0%
  >=29 weeks and <=36 weeks 7 3.3%
  >=37 weeks 201 95.7%
NICU Stay? No 197 92.9%
  Yes 15 7.1%
Newborn Birth Weight LBW 1500-2499 Gm (3.31 lbs-5.5 lbs) 5 2.4%
  NBW >= 2500 Gm 204 97.1%
  VLBW 500-1499 Gm (1.1 lbs-3.3 lbs) 1 0.5%
1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi: 

Consider the results of the following code. I think that report #2 is closer to what you want. BTW, having a relative font_size of 1 forces PDF to make a conversion from relative sizes to point sizes. You would be better off and make less work for PDF if you just specified the font in PTS.

 

cynthia

 

title;

ods pdf file='c:\temp\centerheader.pdf';

PROC REPORT DATA =sashelp.class nowd spanrows

style(report)=[rules=all]

style(header)=[cellheight=.6in font_size=1 background=lightgrey]

style(column)=[font_size=1];

title '1) PROC REPORT is putting string Outcomes on first report row';

title2 'when you blank out the header for the first 2 columns, they still take up space';

title3 'shown here as X and Y';

COLUMN ('Outcomes' age sex) height weight ;

DEFINE age/ GROUP 'X' center;

DEFINE sex/ group 'Y';

DEFINE height/ format=6. "Total Cases" center;

DEFINE weight/ format=percent8.1 "% of Total" center;

RUN;

 

PROC REPORT DATA =sashelp.class nowd spanrows

style(report)=[rules=all]

style(header)=[cellheight=.6in font_size=1 background=lightgrey]

style(column)=[font_size=1];

title '2) Move everything into column statement, then the header row will be completely empty';

title2 'and then PROC REPORT will suppress an entirely empty row';

COLUMN ('Outcomes' age sex) ("Total Cases" height) ('% of Total' weight) ;

DEFINE age/ GROUP ' ' ;

DEFINE sex/ group ' ';

DEFINE height/ format=6. " " ;

DEFINE weight/ format=percent8.1 " " ;

RUN;

ods pdf close;

View solution in original post

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi: 

Consider the results of the following code. I think that report #2 is closer to what you want. BTW, having a relative font_size of 1 forces PDF to make a conversion from relative sizes to point sizes. You would be better off and make less work for PDF if you just specified the font in PTS.

 

cynthia

 

title;

ods pdf file='c:\temp\centerheader.pdf';

PROC REPORT DATA =sashelp.class nowd spanrows

style(report)=[rules=all]

style(header)=[cellheight=.6in font_size=1 background=lightgrey]

style(column)=[font_size=1];

title '1) PROC REPORT is putting string Outcomes on first report row';

title2 'when you blank out the header for the first 2 columns, they still take up space';

title3 'shown here as X and Y';

COLUMN ('Outcomes' age sex) height weight ;

DEFINE age/ GROUP 'X' center;

DEFINE sex/ group 'Y';

DEFINE height/ format=6. "Total Cases" center;

DEFINE weight/ format=percent8.1 "% of Total" center;

RUN;

 

PROC REPORT DATA =sashelp.class nowd spanrows

style(report)=[rules=all]

style(header)=[cellheight=.6in font_size=1 background=lightgrey]

style(column)=[font_size=1];

title '2) Move everything into column statement, then the header row will be completely empty';

title2 'and then PROC REPORT will suppress an entirely empty row';

COLUMN ('Outcomes' age sex) ("Total Cases" height) ('% of Total' weight) ;

DEFINE age/ GROUP ' ' ;

DEFINE sex/ group ' ';

DEFINE height/ format=6. " " ;

DEFINE weight/ format=percent8.1 " " ;

RUN;

ods pdf close;

DanD999
Quartz | Level 8

@Cynthia_sas wrote:

Hi: 

Consider the results of the following code. I think that report #2 is closer to what you want. BTW, having a relative font_size of 1 forces PDF to make a conversion from relative sizes to point sizes. You would be better off and make less work for PDF if you just specified the font in PTS.

 

cynthia

 

title;

ods pdf file='c:\temp\centerheader.pdf';

PROC REPORT DATA =sashelp.class nowd spanrows

style(report)=[rules=all]

style(header)=[cellheight=.6in font_size=1 background=lightgrey]

style(column)=[font_size=1];

title '1) PROC REPORT is putting string Outcomes on first report row';

title2 'when you blank out the header for the first 2 columns, they still take up space';

title3 'shown here as X and Y';

COLUMN ('Outcomes' age sex) height weight ;

DEFINE age/ GROUP 'X' center;

DEFINE sex/ group 'Y';

DEFINE height/ format=6. "Total Cases" center;

DEFINE weight/ format=percent8.1 "% of Total" center;

RUN;

 

PROC REPORT DATA =sashelp.class nowd spanrows

style(report)=[rules=all]

style(header)=[cellheight=.6in font_size=1 background=lightgrey]

style(column)=[font_size=1];

title '2) Move everything into column statement, then the header row will be completely empty';

title2 'and then PROC REPORT will suppress an entirely empty row';

COLUMN ('Outcomes' age sex) ("Total Cases" height) ('% of Total' weight) ;

DEFINE age/ GROUP ' ' ;

DEFINE sex/ group ' ';

DEFINE height/ format=6. " " ;

DEFINE weight/ format=percent8.1 " " ;

RUN;

ods pdf close;


#2 is the one I want. Thanks so much for the quick response and the tip about font_size.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 3253 views
  • 0 likes
  • 2 in conversation