The SAS Output Delivery System and reporting techniques

Preserve Leading Blanks in ODS Output

Reply
Contributor
Posts: 21

Preserve Leading Blanks in ODS Output

I have a mainframe output file that I am trying to convert to a .PDF document to be e.mailed.

The file has been read in line by line as one variable, with an informat of $CHAR112. so that leading blanks are preserved.

If I use Proc Print or Proc Report to just dump the contents, the leading blanks are removed.

If I use DATA _NULL_ with FILE PRINT ODS, the leading blanks are also removed, even if I specify a format of $CHAR112. as a suboption.

The only method which almost works is a simple DATA _NULL_ with a regular PUT statement (not PUT _ODS_). The problem here is that I have to make the font very small to prevent this method from inserting a blank line between every output record, which is also not desired.

So, any ideas on how to maintain leading spaces and prevent extra lines from being printed?
SAS Super FREQ
Posts: 9,260

Re: Preserve Leading Blanks in ODS Output

Hi!
Try the style attribute ASIS=ON in your PRINT or REPORT --

Proc Report data=whatever nowd;
column bigline;
define bigline /display
style(column)={asis=on};
run;

OR
Proc Print data=whatever noobs;
var bigline / style(data)={asis=on};
run;

That attribute generally preserves leading blanks. You may also want to adjust your PDF orientation and/or margins using an option statement:

option orientation=landscape topmargin=.5in bottommargin=.5in leftmargin=.5in rightmargin=.5in;

ods pdf file='.....';

good luck!
cynthia
Contributor
Posts: 72

Re: Preserve Leading Blanks in ODS Output

Posted in reply to Cynthia_sas

Hi Cynthia,

 

What if I want to preserve the format that applied for a variable in proc report to be displayed as is in ODS output..?

 

Thank you,

 

Highlighted
SAS Super FREQ
Posts: 9,260

Re: Preserve Leading Blanks in ODS Output

Hi:
It's not a good idea to add a new question to an 11 year old forum posting. I almost didn't read this because it was so old. I just figured there was a glitch of some kind in the forum interface.

To post a new question, if it is related to a previous post, you can put a link to the previous post in your new post. I don't understand what you mean when you say that you want to "preserve the format" -- typically with "regular" ODS destinations, such as HTML, RTF and PDF, the SAS formats you use (as in a FORMAT statement) are respected. The only time SAS formats are not respected are when you create your output with an Excel-related destination. Excel has its own ideas about how to deal with variable formats and frequently does not respect the SAS format.

It would be better for you to start a new post in the ODS and Reporting forum, with a sample of your data or using a SASHELP data set and an example of the type of format you want preserved. Showing the code you're using, including your ODS destination statements would be very useful. Otherwise, everybody is guessing about what you mean and what your desired output is.

Cynthia
Contributor
Posts: 72

Re: Preserve Leading Blanks in ODS Output

Posted in reply to Cynthia_sas
Sure, will do.. Thanks Cynthia..
Contributor
Posts: 21

Re: Preserve Leading Blanks in ODS Output

Excellent! Worked perfect with Proc Report!

Thanks, Cynthia!
Ask a Question
Discussion stats
  • 5 replies
  • 2316 views
  • 1 like
  • 3 in conversation