<?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: Wrapped text strings in the first column cause unwanted white space in subsequent rows in PROC R in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Wrapped-text-strings-in-the-first-column-cause-unwanted-white/m-p/247186#M46314</link>
    <description>&lt;P&gt;If your going to plain text file, then you would need to put the breaks in yourself. &amp;nbsp;So create a dataset as you want the output to look like then proc report very basic code. &amp;nbsp;This is a bit of a hack, but shows the kind of thing:&lt;/P&gt;
&lt;PRE&gt;data have;
  var1="This is an example of a description that is too long so it wraps down to the next line";
  var2="Manager"; var3=3; id=1; output;
  var2="staff"; var3=2; id=2; output;
  var2="peer"; var3=3; id=3; output;
run;

proc sort data=have out=inter (keep=var1) nodupkey;
  by var1;
run;

data inter (drop=i);
  set inter;
  retain id;
  length var_res $30;
  if _n_=1 then id=1;
  do i=1 to countw(var1);
    if lengthn(strip(var_res)||" "||scan(var1,i," ")) &amp;lt;= 30 then var_res=strip(var_res)||" "||scan(var1,i," ");
    else do;
      output;
      id=id+1;
      var_res=scan(var1,i," ");
    end; 
  end;
run;

proc sql;
  create table WANT as
  select  B.VAR_RES as VAR1,
          A.VAR2,
          A.VAR3
  from    WORK.HAVE A
  left join WORK.INTER B
  on      A.ID=B.ID;
quit;&lt;/PRE&gt;</description>
    <pubDate>Mon, 01 Feb 2016 12:37:05 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-02-01T12:37:05Z</dc:date>
    <item>
      <title>Wrapped text strings in the first column cause unwanted white space in subsequent rows in PROC REPOR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wrapped-text-strings-in-the-first-column-cause-unwanted-white/m-p/247179#M46313</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;Hope someone can help me with the below issue. As I have not been able to the issue myself and I am running out of ideas. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have a similar question as have been previously posted (&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/getting-proc-report-spanrows-to-work-correctly-with-long-lines/m-p/203474/highlight/true#M13537" target="_self"&gt;getting proc report spanrows to work correctly with long lines of text in PDF output&lt;/A&gt;) and the work around&amp;nbsp;&lt;A href="http://support.sas.com/kb/45/549.html" target="_self"&gt;Usage Note 45549: Wrapped text strings in the first column cause unwanted white space in subsequent rows in PROC REPORT and PROC TABULATE output routed to ODS PDF&lt;/A&gt;) mentioned. However, my output format is txt and not ODS PDF. Does this change the anything regarding how to work around this problem?&amp;nbsp;&lt;/P&gt;&lt;P&gt;kind regards&lt;/P&gt;&lt;P&gt;FHeinen&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 11:55:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wrapped-text-strings-in-the-first-column-cause-unwanted-white/m-p/247179#M46313</guid>
      <dc:creator>FHeinen</dc:creator>
      <dc:date>2016-02-01T11:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapped text strings in the first column cause unwanted white space in subsequent rows in PROC R</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wrapped-text-strings-in-the-first-column-cause-unwanted-white/m-p/247186#M46314</link>
      <description>&lt;P&gt;If your going to plain text file, then you would need to put the breaks in yourself. &amp;nbsp;So create a dataset as you want the output to look like then proc report very basic code. &amp;nbsp;This is a bit of a hack, but shows the kind of thing:&lt;/P&gt;
&lt;PRE&gt;data have;
  var1="This is an example of a description that is too long so it wraps down to the next line";
  var2="Manager"; var3=3; id=1; output;
  var2="staff"; var3=2; id=2; output;
  var2="peer"; var3=3; id=3; output;
run;

proc sort data=have out=inter (keep=var1) nodupkey;
  by var1;
run;

data inter (drop=i);
  set inter;
  retain id;
  length var_res $30;
  if _n_=1 then id=1;
  do i=1 to countw(var1);
    if lengthn(strip(var_res)||" "||scan(var1,i," ")) &amp;lt;= 30 then var_res=strip(var_res)||" "||scan(var1,i," ");
    else do;
      output;
      id=id+1;
      var_res=scan(var1,i," ");
    end; 
  end;
run;

proc sql;
  create table WANT as
  select  B.VAR_RES as VAR1,
          A.VAR2,
          A.VAR3
  from    WORK.HAVE A
  left join WORK.INTER B
  on      A.ID=B.ID;
quit;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Feb 2016 12:37:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wrapped-text-strings-in-the-first-column-cause-unwanted-white/m-p/247186#M46314</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-01T12:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapped text strings in the first column cause unwanted white space in subsequent rows in PROC R</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Wrapped-text-strings-in-the-first-column-cause-unwanted-white/m-p/247213#M46316</link>
      <description>&lt;P&gt;Whe you say the output format is text, I assume&amp;nbsp;you're writing to the SAS listing (or some other non-styled output file). In this case the solutions that rely on ODS styles won't work and SPANROWS doesn't apply. You'll have to fall back to the old-school PROC REPORT listing options. Check out the &lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473627.htm" target="_self"&gt;WIDTH and FLOW options on the DEFINE statement&lt;/A&gt;&amp;nbsp;for example.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 14:57:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Wrapped-text-strings-in-the-first-column-cause-unwanted-white/m-p/247213#M46316</guid>
      <dc:creator>Tim_SAS</dc:creator>
      <dc:date>2016-02-01T14:57:41Z</dc:date>
    </item>
  </channel>
</rss>

