- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I would like to write the source code to a pdf, before displaying the results of the code.
I can use a series of ods pdf text=""; statements, and insert new lines and spacing as needed, but is there a way to put pre formatted text, like with an html <pre> tag so that I do not have to add all the escape characters with newline and nbspace to the source code?
Thank you
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
PROC REPORT seems to work better at preserving the leading spaces.
ods pdf file='c:\downloads\code.pdf';
proc report data=code ;
column line code ;
define line / order ;
define code / style(column)=[font_face=courier asis=on];
run;
proc print data=code;
id line;
var code / style = [font_face=courier asis=on];
run;
ods pdf close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Why not use PROC PRINT?
data code ;
infile cards truncover ;
line+1;
input code $char80. ;
format code $char80. ;
cards4;
proc print data=sashelp.class;
var name age;
run;
;;;;
ods pdf file='c:\downloads\code.pdf';
proc print data=code ;
id line;
var code / style(data)=[font_face=courier];
run;
ods pdf close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
PROC REPORT seems to work better at preserving the leading spaces.
ods pdf file='c:\downloads\code.pdf';
proc report data=code ;
column line code ;
define line / order ;
define code / style(column)=[font_face=courier asis=on];
run;
proc print data=code;
id line;
var code / style = [font_face=courier asis=on];
run;
ods pdf close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That was very helpful, thank you.
I tweaked the report a bit to get the output from this :
to this:
proc report data=code style=blockprint;
column line code ;
define line / '' order noprint;
define code / '' style(column)=[asis=on];
run;