BookmarkSubscribeRSS Feed
fred777
Calcite | Level 5

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!

 

 

4 REPLIES 4
Ksharp
Super User

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;
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

fred777
Calcite | Level 5

Mate

 

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

A_Seratte
Calcite | Level 5

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2318 views
  • 0 likes
  • 4 in conversation