DATA Step, Macro, Functions and more

ods pdf text formatting

Reply
Occasional Contributor
Posts: 14

ods pdf text formatting

[ Edited ]

Hi All, i faced with a problem when creating .pdf output. At the moment output looks like this:

But i have to remove "~" symbols. For .rtf format it is working correctly ,just using escapechar="~". Is there any way to remove "~" using soome options or parameters in "ods pdf" ?

 code:

%if &form=pdf %then %do;
ods pdf file="&path.out/&prefix. Incidence of all Adverse Events.pdf" style=Journal;
%end;
OPTIONS PAPERSIZE=A4 ORIENTATION=Portrait linesize=max;
ODS escapechar="~";

options missing=' ';

proc report data=final style={protectspecialchars=yes} nowd missing split='@';
columns col1 col2 col3 col4 ;
define col1 / display left 'System Organ Class@ Preferred Term' ;
define col2 / display center 'Number @ of Patients' ;
define col3 / display center 'Percentage @ of Patients';
define col4 / display center 'Number @ of Events';
run;
ods &form close;

 

I tried to use col1='a0'x||strip(col1); but it is working really strange, for some rows it is adding  1 blank and in some rows it is deleting combination of letters 'an'  even in header ))).

 

Also i tried to use: col1= ' ~{nbspace 4} ' ||strip(col1); but in output it appeares as a text.

 

 


Capturesssss.JPG
Frequent Contributor
Posts: 75

Re: ods pdf text formatting

If the ~ is embedded in the column, have you tried using the tranwrd function ot take it out of the text string? It would work like this:

NewVar=tranwrd(Yourvar,'~','');
Frequent Contributor
Posts: 75

Re: ods pdf text formatting

If the '~' is embedded in the column, have you tried using the tranwrd function ot take it out of the text string? It would work like this:

NewVar=tranwrd(Yourvar,'~','');

 

SAS Super FREQ
Posts: 8,868

Re: ods pdf text formatting

Looking at your report, it appears that someone tried to fake out indention for some of the report rows by padding the row with tildes (~). I don't know why you have the protectspecialchars=yes, unless your data also has RTF control strings embedded in the data. You did not post the data, so it is nearly impossible to guess.

You can accomplish the indention using the leftmargin style attribute, as I show here https://communities.sas.com/t5/ODS-and-Base-Reporting/Indent-different-rows-of-a-column-in-RTF/td-p/... and here https://communities.sas.com/t5/ODS-and-Base-Reporting/ods-pdf-proc-report-indent-column-conditionall... (with picture) and here https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Indent-and-background-color/td-p/1... and there are many other postings about LEFTMARGIN or INDENT that you could search for. Also, if you want to use RTF control strings, then \tab usually works to indent, as shown here https://communities.sas.com/t5/ODS-and-Base-Reporting/formatting-multiple-line-statements-in-proc-re..., in which case you would need protectspecialchars=off.

cynthia
Occasional Contributor
Posts: 14

Re: ods pdf text formatting

Posted in reply to Cynthia_sas

Thank you all for your attention! I found the solution :

col1='a0'x||'a0'x||'a0'x||'a0'x||'a0'x||strip(aeterm_pt); it is adding 5 spaces , but it works correctly  for .pdf and .rtf when using next options in proc report definition:

proc report data=final style={protectspecialchars=on} nowd missing formchar(2)='_'   split='@';

SAS Super FREQ
Posts: 8,868

Re: ods pdf text formatting

Formchar is a LISTING only option. should not work for PDF or RTF, per the doc
http://support.sas.com/documentation/cdl/en/proc/69850/HTML/default/viewer.htm#n1dz7jdasx5t56n1rmlx3...

cynthia
Ask a Question
Discussion stats
  • 5 replies
  • 216 views
  • 0 likes
  • 3 in conversation