<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: proc report compute before with long sentences in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/proc-report-compute-before-with-long-sentences/m-p/984452#M43718</link>
    <description>&lt;PRE&gt;data tab2;
input group :$40. variable;
length _group $ 80;
&lt;STRONG&gt;_group=cat(substr(group,1,8),'(*ESC*)n             ',substr(group,9));&lt;/STRONG&gt;
cards;
aaaaaaaaaaaa 10
aaaaaaaaaaaa 20
bbbbbbbbbbbb 30
bbbbbbbbbbbb 40
;


ods rtf file='c:\temp\temp.rtf' style=journal bodytitle;
title1 justify=left bold height=2 color=blue "Table 2. Patients";
proc report data=tab2 nowindows spacing=1 headline headskip split= "|"  style(report)={outputwidth=100% cellspacing=0 borderwidth=1} style(header) = {font_weight = bold};

    columns _group variable ;
	define &lt;STRONG&gt;_group&lt;/STRONG&gt;/group noprint;
	define variable/display left width=10 " ";
	compute before &lt;STRONG&gt;_group&lt;/STRONG&gt;/style(lines)={just=left fontweight=bold width=50 &lt;STRONG&gt;asis=on&lt;/STRONG&gt;}; 
    line @1 "Group: " &lt;STRONG&gt;_group &lt;/STRONG&gt; $100.; 
endcomp;
run;

footnote1;
title1;
ods rtf close;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="屏幕截图 2026-03-07 155239.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113474i7EC56A60F840B75D/image-size/large?v=v2&amp;amp;px=999" role="button" title="屏幕截图 2026-03-07 155239.png" alt="屏幕截图 2026-03-07 155239.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 07 Mar 2026 07:53:51 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2026-03-07T07:53:51Z</dc:date>
    <item>
      <title>proc report compute before with long sentences</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-report-compute-before-with-long-sentences/m-p/984424#M43715</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm running the following code:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title12justify=left bold height=2 color=blue "Table 2. Patients";
proc report data=tab2 nowindows spacing=1 headline headskip split= "|"  style(report)={outputwidth=100% cellspacing=0 borderwidth=1} style(header) = {font_weight = bold};

    columns group variable count percentage;
	define group/group noprint;
	define variable/display left width=10 " ";
	define count/ display center width= 10 "N";
	define percentage/ display center width= 10 "%";
	compute before group/style(lines)={just=left fontweight=bold width=50}; 
    line @1 "Group: " group  $char100.; 
endcomp;
run;

footnote1;
title1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The Group variable contains&amp;nbsp; long sentences.&lt;/P&gt;
&lt;P&gt;Is there a way to go "next row"?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried:&lt;/P&gt;
&lt;P&gt;line @1 Group $varying40.; &lt;BR /&gt;line @1 "" +12;&lt;/P&gt;
&lt;P&gt;but without success.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help me please?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2026 14:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-report-compute-before-with-long-sentences/m-p/984424#M43715</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2026-03-06T14:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: proc report compute before with long sentences</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-report-compute-before-with-long-sentences/m-p/984427#M43716</link>
      <description>&lt;P&gt;Which destination are you routing the output to? Can you send your complete code and a sample of the output? I would suggest the CELLWIDTH style attribute. Also note that I changed Group to Order on the DEFINE statement, since you cannot have Group and Display in the same report definition.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=tab2 nowindows spacing=1 headline headskip split= "|"  
 style(report)={outputwidth=100% cellspacing=0 borderwidth=1} 
 style(header) = {font_weight = bold};

columns group variable count percentage;
define group/order noprint;
define variable/display left width=10 " ";
define count/ display center width= 10 "N";
define percentage/ display center width= 10 "%";

compute before group/style(lines)={just=left fontweight=bold cellwidth=3in}; 
    line @1 "Group: " group  $char100.; 
endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Mar 2026 16:39:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-report-compute-before-with-long-sentences/m-p/984427#M43716</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2026-03-06T16:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: proc report compute before with long sentences</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-report-compute-before-with-long-sentences/m-p/984429#M43717</link>
      <description>&lt;P&gt;Maybe something like this ...&lt;/P&gt;
&lt;P&gt;Note: below code was not tested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used this blog to insert a split character (~) after 50 positions.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sgf/2021/02/15/inserting-a-substring-into-a-sas-string/" target="_blank"&gt;Inserting a substring into a SAS string - SAS Users&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tab2;
 set tab2;
 insertposition=50;
 splitchar='~';
 length PHRASE $105;
 PHRASE = catx(' ',substr(group,1,insertposition-1),splitchar,substr(group,insertposition));
run;

proc report data=tab2 nowindows spacing=1 headline headskip split= "|"  
            style(report)={outputwidth=100% cellspacing=0 borderwidth=1} style(header)={font_weight = bold};
    column group variable count percentage;
	define group      / order   noprint;
	define variable   / display left   width=10 " ";
	define count      / display center width=10 "N";
	define percentage / display center width=10 "%";
compute before group / style(lines)={just=left fontweight=bold width=50}; 
   length part1 part2 $50;
   part1 = scan(PHRASE,1,'~');
   part2 = scan(PHRASE,2,'~');
   line part1 $50.;
   line part2 $50.;
endcomp;
run;
QUIT;

title; footnote;
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;BR, Koen&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2026 17:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-report-compute-before-with-long-sentences/m-p/984429#M43717</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2026-03-06T17:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: proc report compute before with long sentences</title>
      <link>https://communities.sas.com/t5/New-SAS-User/proc-report-compute-before-with-long-sentences/m-p/984452#M43718</link>
      <description>&lt;PRE&gt;data tab2;
input group :$40. variable;
length _group $ 80;
&lt;STRONG&gt;_group=cat(substr(group,1,8),'(*ESC*)n             ',substr(group,9));&lt;/STRONG&gt;
cards;
aaaaaaaaaaaa 10
aaaaaaaaaaaa 20
bbbbbbbbbbbb 30
bbbbbbbbbbbb 40
;


ods rtf file='c:\temp\temp.rtf' style=journal bodytitle;
title1 justify=left bold height=2 color=blue "Table 2. Patients";
proc report data=tab2 nowindows spacing=1 headline headskip split= "|"  style(report)={outputwidth=100% cellspacing=0 borderwidth=1} style(header) = {font_weight = bold};

    columns _group variable ;
	define &lt;STRONG&gt;_group&lt;/STRONG&gt;/group noprint;
	define variable/display left width=10 " ";
	compute before &lt;STRONG&gt;_group&lt;/STRONG&gt;/style(lines)={just=left fontweight=bold width=50 &lt;STRONG&gt;asis=on&lt;/STRONG&gt;}; 
    line @1 "Group: " &lt;STRONG&gt;_group &lt;/STRONG&gt; $100.; 
endcomp;
run;

footnote1;
title1;
ods rtf close;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="屏幕截图 2026-03-07 155239.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/113474i7EC56A60F840B75D/image-size/large?v=v2&amp;amp;px=999" role="button" title="屏幕截图 2026-03-07 155239.png" alt="屏幕截图 2026-03-07 155239.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2026 07:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/proc-report-compute-before-with-long-sentences/m-p/984452#M43718</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2026-03-07T07:53:51Z</dc:date>
    </item>
  </channel>
</rss>

