While using Proc Printto ; I am facing these issues , Any way out for these
Proc Printto print = txt
1) How to do Left & Right Alignment of header and footer
2) Left & Right Alignment for columns and data corresponding to the Column
3) if I reduce the line size then it trunc the output from right side which is loss of data.
An ASCII text file, such as that produced by PROC PRINTTO does not offer much in the way of cosmetic improvement, such as data, column, or header alignment.
If you are producing the PRINTTO output from a SAS procedure, then in your viewer (such as Notepad or Word), when you open the file, you can see the output, as SAS created it, by choosing to display the file in the SAS Monospace font at 8 or 9 pt.
For example, if I run the program below (note the special justifications applied in PROC REPORT), I can only see the justifications, if I change my Notepad font to SAS Monospace 9 pt when I view the file.
If you need to create files that can have alignment formatting, can have page breaks and can be easily printed, you may want to consider using ODS PDF or ODS RTF destinations (instead of PROC PRINTTO).
** View this file in Notepad, but you must change the Notepad;
** font to SAS Monospace 9 PT to see alignment respected.;
proc report data=sashelp.class nowd;
title 'The Centered Title in the LINESIZE';
column name age height;
define name / 'Name' right;
define age / 'The Age' center f=3.0 width=7;
define height / 'Height' left f=4.1 width=6;
Numeric columns are right-aligned, and character columns are left aligned by default. Numerical column cold be left aligned by converting them to char format.
Another possibility is if you use data step reporting, where you have more possibilities to format your output. But this is quite time-consuming, and the report will be fixed to text reporting only. So a more generic and flexible approach is to have a look at ODS functionality, as Cynthia mentioned.
If you run my test program AND if you view the resulting TEXT file in Notepad or Word with SAS Monospace font, 9pt, you WILL see that the alignment specified in the PROC REPORT code has been applied.
If you look at the text file in any viewer with a proportional font, it will not look like it did when SAS created it. You MUST view the file with SAS Monospace 9pt to see the alignment (or Courier New will probably work).
PROC PRINTTO creates an ASCII text file. Any font settings belong to the viewer you use when you open the text file. Therefore, SAS does not have any control over the font of the text in the ASCII text file.
"ASCII text file A file which consists of a series of lines terminated by a hard carriage return and which contains no formatting information and can thus be read by any text editor. Most word processors have a mode for reading and writing ASCII text files, i.e. for suppressing the formatting information, page layout, page breaks, typeface attributes, etc. which they normally include in the text files they create."
I don't really understand exactly what you want or need to do. However, in my experience, most folks who email SAS results to other people use the Output Delivery System. If you create an RTF or PDF or HTML file, then the output will contain formatting instructions such as a font specification. In addition, if you sent a PDF file, the PDF file would be "printer-ready".
ODS uses the same "sandwich" technique as PROC PRINTTO. For example, if you wanted to create a PDF file for mailing, you could do this:
ODS PDF file='c:\temp\mailthis.pdf';
proc print data=sashelp.class;
ODS PDF CLOSE;
ODS PDF uses either Helvetica or Times New Roman in SAS 9.1.3, which are fonts available on most computer systems. Once the PDF file is created, you can then mail the file. Similar syntax could be used for ODS RTF or ODS HTML output results.