The SAS Output Delivery System and reporting techniques

ODS Excel - adding a tab into a title or footnote statement.

Reply
Occasional Contributor
Posts: 12

ODS Excel - adding a tab into a title or footnote statement.

As the title says, I'd like to put a tab into the title or footnote of a spreadsheet coming out of ODS Excel.

Now this can be easily done with ODS RTF, e.g.:

   ods escapechar='^';

   title  "^R/RTF""\tab""   ";

 

But I can't for the life of me work out how to do it for ODS Excel.

 

I know about {nbspace N} where N is the no. of spaces to insert,

(example: footnote "Version:^{nbspace 3}1";

but I really want tabs!

 

I also tried this:

   footnote "Author:" '09'x "Fred";

but it had no effect.

 

Any help greatly appreciated!

 

 

Super User
Posts: 9,681

Re: ODS Excel - adding a tab into a title or footnote statement.

Very interesting. Can you use white blanks to instead of TAB character ?

 

ods excel file='/folders/myfolders/x.xlsx' options(Embedded_Titles='yes') style=sasweb;
title "Title          Title";
proc print data=sashelp.class;run;
ods excel close;
Super User
Super User
Posts: 7,401

Re: ODS Excel - adding a tab into a title or footnote statement.

Why?  Excel is a tabular system, it is not a word processor.  Have you tried putting tabs into an Excel document directly - it is very difficult.  If you need a nice report for review then use a format associated with review - RTF, PDF etc.  If you need an Excel output then create an Excel output, if you need data then use a data transport format.

 

As a side note, I would never use tabs anywhere.  The reason is there is no consistent spacing for them, so whatever application you render the output in may well change the look of the output.  Spaces are far more controllable.

Occasional Contributor
Posts: 12

Re: ODS Excel - adding a tab into a title or footnote statement.

Mate

 

If you don't know the answer, just say so.

New User
Posts: 1

Re: ODS Excel - adding a tab into a title or footnote statement.

Here is how I code it using ODS Excel in EG7.1 on 9.4 platform:

ods _ALL_ close;
Ods noresults;
options leftmargin = .25in
rightmargin = .25in
topmargin = .75in
bottommargin = .5in
papersize=LEGAL
orientation=landscape
;

ods escapechar="~";
ods Excel

file="[filename].xlsx"
Author="A_Seratte"
style=SEASIDE;

proc print data = ... label noobs;

ODS Excel
options ( sheet_interval="BYGROUP"
sheet_name="#byval(office)"

...);

title2 BOLD "&L&[tab]" ;

 var...;

by OFFICE ;
run;

ods Excel close;
ods listing;
ods results;

 

The&L left aligns it in Excel, though SAS will give you a warning or error message, and the &[tab] is straight from Excel. Comes out for me every time.

Ask a Question
Discussion stats
  • 4 replies
  • 407 views
  • 0 likes
  • 4 in conversation