> 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