BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
AIO
Calcite | Level 5 AIO
Calcite | Level 5

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?

test.png


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;

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.

View solution in original post

4 REPLIES 4
ballardw
Super User

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.

Tom
Super User Tom
Super User

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.

Tom
Super User Tom
Super User

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.

AIO
Calcite | Level 5 AIO
Calcite | Level 5

Thank you very much. It works well.👍

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 4 replies
  • 803 views
  • 2 likes
  • 3 in conversation