BookmarkSubscribeRSS Feed
Jeka
Obsidian | Level 7

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
5 REPLIES 5
nehalsanghvi
Pyrite | Level 9

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,'~','');
nehalsanghvi
Pyrite | Level 9

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,'~','');

 

Cynthia_sas
SAS Super FREQ
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
Jeka
Obsidian | Level 7

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='@';

Cynthia_sas
SAS Super FREQ
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1637 views
  • 0 likes
  • 3 in conversation