When I use LINE sentence in PROC REPORT to display a text, there are two kind spcae showed in rtf file, please refer to the screenshot. You can find the space characters in footnote are different. My code is as below. Is there anyone know the reason? And how can I only display the normal space in rtf file?
ods listing close;
ods rtf file="...\test.rtf";
proc report nowd data=sashelp.class style(report)={cellwidth=100%};
compute after _page_/style={just=l };
line "Note: Patients are counted at most once for each body system.";
line "Note: Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system.";
endcomp;
run;
ods rtf close;
ods listing;
Use the RAW style.
Example:
filename rtf temp;
ODS ESCAPECHAR='^';
ods rtf file=rtf;
proc report nowd data=sashelp.class(obs=5) style(report)={cellwidth=100%};
compute after _page_/style={just=l };
line "Note: NORMAL Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system.";
line "^{raw Note: RAW Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system.}";
endcomp;
run;
ods rtf close;
You can look at the RTF file with a simple data step to see the results:
3566 data _null_; 3567 infile rtf; 3568 input ; 3569 if index(_infile_,'Note:'); 3570 put / _infile_; 3571 run; NOTE: The infile RTF is: (system-specific pathname), (system-specific file attributes) \pard\plain\intbl\keepn\sb60\sa60\ql\f1\fs20\cf1{Note: NORMAL Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note:\~Patients\~are \~counted\~at\~most\~once\~for\~each\~body\~system.{\line} {Note: RAW Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system.}\cell} \pard\plain\intbl\keepn\sb60\sa60\ql\f1\fs20\cf1{Note: NORMAL Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note:\~Patients\~are \~counted\~at\~most\~once\~for\~each\~body\~system.{\line} {Note: RAW Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system.}\cell} NOTE: 132 records were read from the infile (system-specific pathname). The minimum record length was 6. The maximum record length was 258. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds
So for the "NORMAL" lines SAS will start inserting the non-breaking spaces when the lines get too long. But for the RAW lines it does not.
Since SAS has an explicit FOOTNOTE statement with it's own set of behaviors please do not refer to code you write with a LINE (or Posttext or other code) to mimic a footnote as that can cause confusion.
Depending on how you wrote the text in your Line statements, such as possibly copy and paste from some other source, we would need to see the text as written to see what may be going on. The main message windows on this forum will reformat pasted text. So what is shown in your message is quite likely not the actually code submitted. I suggest copying the code from your editor, open a text box with the </> icon that appears above the message box and then paste the code.
Looks to me like it is doing that to prevent WORD (or whatever program is going to open and interpret the RTF commands) from wrapping those lines.
Use the RAW style.
Example:
filename rtf temp;
ODS ESCAPECHAR='^';
ods rtf file=rtf;
proc report nowd data=sashelp.class(obs=5) style(report)={cellwidth=100%};
compute after _page_/style={just=l };
line "Note: NORMAL Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system.";
line "^{raw Note: RAW Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system.}";
endcomp;
run;
ods rtf close;
You can look at the RTF file with a simple data step to see the results:
3566 data _null_; 3567 infile rtf; 3568 input ; 3569 if index(_infile_,'Note:'); 3570 put / _infile_; 3571 run; NOTE: The infile RTF is: (system-specific pathname), (system-specific file attributes) \pard\plain\intbl\keepn\sb60\sa60\ql\f1\fs20\cf1{Note: NORMAL Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note:\~Patients\~are \~counted\~at\~most\~once\~for\~each\~body\~system.{\line} {Note: RAW Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system.}\cell} \pard\plain\intbl\keepn\sb60\sa60\ql\f1\fs20\cf1{Note: NORMAL Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note:\~Patients\~are \~counted\~at\~most\~once\~for\~each\~body\~system.{\line} {Note: RAW Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system. Note: Patients are counted at most once for each body system.}\cell} NOTE: 132 records were read from the infile (system-specific pathname). The minimum record length was 6. The maximum record length was 258. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds
So for the "NORMAL" lines SAS will start inserting the non-breaking spaces when the lines get too long. But for the RAW lines it does not.
Thank you very much. It works well.👍
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.