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
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.
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
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.
Hi,
Please see the attached file for code and output.
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?
Hi , i want to display / in my header, like "Sales/Year"
but sas doing it as "Sales
Year"
how i can set my display??
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?
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.