ODS and Base Reporting

Build reports by using ODS to create HTML, PDF, RTF, Excel, text reports and more!
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ChristineKraft
Fluorite | Level 6

I just upgraded to SAS 9.4 TS1M5 from 9.4 TS1M1 and am excited to use ODS EXCEL. But when I use the print_footer option with the same macro variable (see below) I had been using with ODS TAGSETS.EXCELXP, it ignores the newline character. Has anyone else had this problem and know how to fix it?

 

Macro I have been using:

%let footer_text =&LInstitutional Research and Assessment (&name)&#13The University of Alabama
&R&fdate, Page &P of &N&#13&Z&F;

Footer in Excel that I used to get using above footer and ODS TAGSETS.EXCELXP:

footer_desired.jpg

Footer in Excel that I now get using the above macro variable and ODS EXCEL:

 

footer.jpg

Using this code:

ods excel 
	file="&fname"
	style = ad_hoc
	options(embedded_titles='yes' 
			embedded_footnotes='yes'
			print_footer="&footer_text"
			sheet_name="UA"
			orientation = 'portrait'
			absolute_column_width="12"
			fittopage = "yes"
			center_horizontal = 'yes'
			title_footnote_width = '7' 
	);

Any help is appreciated! Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ChristineKraft
Fluorite | Level 6

After opening a track with SAS Technical Support, Chevell Parker came up with this solution, which works like a charm! Thank you, Chevell! 

 

 

TITLE;
FOOTNOTE;

ODS excel file="test.xlsx" 
options(sheet_name='TEST_DATA01_05OCT2017D' orientation='portrait' 
print_footer="&LInstitutional Research and Assessment (&name) 
The University of Alabama &R &fdate, Page &P of &N 
 &Z &F");

PROC REPORT DATA=sashelp.class;

define name / style(column)=[just=c];

RUN;

ods excel close;

Or, if you want the footnote in a macro variable as we do in our office, your code could look like this:

%let footer_text =%str(&LInstitutional Research and Assessment (&name)
The University of Alabama &R &fdate, Page &P of &N 
 &Z &F);

TITLE;
FOOTNOTE;

ODS excel file="test.xlsx" 
options(sheet_name='TEST_DATA01_05OCT2017D' orientation='portrait' 
print_footer="&footer_text");

PROC REPORT DATA=sashelp.class;

define name / style(column)=[just=c];

RUN;

ods excel close;

 

And the output looks like this in both cases:

 solutiom.jpg

 

View solution in original post

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:
  I do observe the difference you describe, I did not have the "ad_hoc" style, so used the HTMLBLUE style. In your code, you used &#13, I have seen an alternative to that is 
 however, that produced the same results. You might want to open a track with Tech Support about this different behavior of the Alt+Enter for a new line with ODS EXCEL.

cynthia

ChristineKraft
Fluorite | Level 6

After opening a track with SAS Technical Support, Chevell Parker came up with this solution, which works like a charm! Thank you, Chevell! 

 

 

TITLE;
FOOTNOTE;

ODS excel file="test.xlsx" 
options(sheet_name='TEST_DATA01_05OCT2017D' orientation='portrait' 
print_footer="&LInstitutional Research and Assessment (&name) 
The University of Alabama &R &fdate, Page &P of &N 
 &Z &F");

PROC REPORT DATA=sashelp.class;

define name / style(column)=[just=c];

RUN;

ods excel close;

Or, if you want the footnote in a macro variable as we do in our office, your code could look like this:

%let footer_text =%str(&LInstitutional Research and Assessment (&name)
The University of Alabama &R &fdate, Page &P of &N 
 &Z &F);

TITLE;
FOOTNOTE;

ODS excel file="test.xlsx" 
options(sheet_name='TEST_DATA01_05OCT2017D' orientation='portrait' 
print_footer="&footer_text");

PROC REPORT DATA=sashelp.class;

define name / style(column)=[just=c];

RUN;

ods excel close;

 

And the output looks like this in both cases:

 solutiom.jpg

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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