The SAS Output Delivery System and reporting techniques

ALIGN TITLE

Reply
Frequent Contributor
Posts: 97

ALIGN TITLE

Hi

I have a title as

REPRORT_ID Report for Invoices Page 1

I want Report_ID to be left aligned
Report title i.e. Report for Invoices as center aligned
Page 1 i.e. page numberings as right aligned
SAS Super FREQ
Posts: 8,743

Re: ALIGN TITLE

Hi:
It depends on your destination. If you are using the LISTING destination and sending output to an ASCII text file, then you cannot variably adjust the alignment of text strings for Text output, -easily-. There used to be a SAS macro program that you could run that would figure out your LINESIZE and then split the string, but you'd have to ask Tech Support whether they even know how to get a copy of that macro -- I used to use something like it in my mainframe days (long, long ago).

However, generally, for HTML, RTF and PDF, you can do this:[pre]
title j=l 'Left' j=c 'Center' j=r 'Right';[/pre]

Not all HTML-based tagsets will "accept" this syntax, however. If you use MSOFFICE2K tagset, the differing strings will appear on 3 separate lines.

Here's some code to test:
[pre]
options nodate nonumber;

ods listing;
ods html file='c:\temp\test_title.html' style=sasweb;
ods rtf file='c:\temp\test_title.rtf';
ods pdf file='c:\temp\test_title.pdf';
ods msoffice2k file='c:\temp\test_title_mso.html' style=sasweb;

ods escapechar = '~';
title j=r 'Page ~{thispage}';
title2 j=l 'Left' j=c 'Center' j=r 'Right';

proc print data=sashelp.class;
var name age height;
run;
ods _all_ close;
[/pre]

cynthia
Frequent Contributor
Posts: 97

Re: ALIGN TITLE

Thanks, I think it should work for PROCREPORT as well.
N/A
Posts: 0

Re: ALIGN TITLE



> It depends on your destination. If you are using
> the LISTING destination and sending output to an
> ASCII text file, then you cannot variably adjust the
> alignment of text strings for Text output, -easily-.
> There used to be a SAS macro program that you could
> run that would figure out your LINESIZE and then
> split the string, but you'd have to ask Tech Support
> whether they even know how to get a copy of that
> macro -- I used to use something like it in my
> mainframe days (long, long ago).



I still occasionally use output destinations that support this Cynthia, although I haven't written a macro to perform the task.

The key constraint is that the output medium must be using a non-proportional font, otherwise all bets are off and this won't work consistently as expected. Aside from anything else, a space character in a proportional font is narrower than "i" in either case, or "L" in lower case.

Our old friend %SysFunc( GetOption( LineSize) ) will retrieve the system setting for the length of the output line in characters, and use of the Left(), Trim() and Length() functions will retrieve the length of the title string which can then be prepended with the appropriate number of spaces.

I would never do this in ODS. As you showed there are many approaches which are much less complex and easier to achieve, however, for producing survey forms I still tend to program with the approach that I know I can make work quickly.

Kind regards

David
Ask a Question
Discussion stats
  • 3 replies
  • 155 views
  • 0 likes
  • 3 in conversation