BookmarkSubscribeRSS Feed
p9jain
Calcite | Level 5

Hi,

I have a  variable content value as a test\reference. I want to print that value in RTF but instead of print slash (\) its prints some symbol between test and refernce. Does any one help to print the back slash. I am using proc report.

Thanks

8 REPLIES 8
AncaTilea
Pyrite | Level 9

When I try this (see code below, which is just a sample code to get an idea for myself) the "\" print in the rtf document.

Could you share the code?

ods rtf file = "back_slash.rtf";

proc report nowd data=sashelp.class ;

column age weight;

define age/display "Age\over nothing";

define weight /display;

run;

ods rtf close;

Let me know if it works?

Thanks and good luck!

Anca.

p9jain
Calcite | Level 5


Thanks Anca, I do'nt need it for header. For e.g. you have age variable and values as 23\Y, 45\Y in dataset.

I used the same syntax but 23\Y is not reflecting in RTF. instead of \ its showing sybol shaped Y.

Sorry if I was not clear earlier.

Thanks,

Priyanka

AncaTilea
Pyrite | Level 9

OK,

Please see attached.

data temp;

length new_age $5.;

set sashelp.class;

if age = 12 then new_age = "12\y";

    else new_age = age;

run;

ods rtf file = "back_slash.rtf";

proc report nowd data=temp;

column new_age weight;

define new_age/display "Age\over nothing";

define weight /display;

run;

ods rtf close;

Would share the code, please? (with some fake data)

Thanks.

Anca.

PS: I had to attach it as .PDF because it wouldn't allow me to attach .RTF file.

p9jain
Calcite | Level 5

Hi,

Please see the attached file for code and output.

AncaTilea
Pyrite | Level 9

I see.

I get it to work.

can you close/open SAS to make sure you have no other options set?

I added an ods pdf file = "c\pk.pdf";

...code...

ods pdf close;

and it worked (see attached);

hmmmm....

I try to think what else may cause this?

Aman4SAS
Obsidian | Level 7

Hi , i want to display / in my header, like "Sales/Year"

but sas doing it as  "Sales

                             Year"

how i can set my display??

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

Check:

What is your escape char set to, e.g.

ods escapechar='^';

In your proc report statement do you have split= set, e.g.

proc report data=mydata split='~';

In your initial PDF, it looks like you have a special language set loaded, something in your intialisation?

Cynthia_sas
SAS Super FREQ

Hi,

My suggestion is that the original poster (p9jain) work with Tech Support. When I run either your code or the OP code in SAS 9.4, I correctly see the \ in the output. While it is true that the \ generally has special meaning to RTF, such as when using RTF control strings directly in the output, my suspicion is something having to do with fonts in the OP version of Microsoft Word instead of something with SAS. When I run either code, as I said, using SAS 9.4 and Word 2013, I do see the back slash in the output. See the attached screen shots. My font, as set by the STYLE template for RTF  (styles.rtf) is using Times New Roman. It's better to compare apples to apples. If the OP wants RTF, then comparing to PDF or creating output to PDF is not a fair test. PDF might have different default fonts than RTF. If the OP wants RTF, then the RTF examples should be the ones compared.

cynthia


what_rtf_looks_like_sas94.pngrun_OP_code_what_rtf_sas94.png

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
  • 8 replies
  • 5542 views
  • 1 like
  • 5 in conversation