<?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 Merge multiple lines into one record in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merge-multiple-lines-into-one-record/m-p/807238#M318216</link>
    <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I have dataset with one column that contains a lot of records.&lt;/P&gt;&lt;P&gt;For example the first 3:&lt;/P&gt;&lt;P&gt;abc&lt;/P&gt;&lt;P&gt;&amp;nbsp;def&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; ghi&lt;/P&gt;&lt;P&gt;How can i merge it into 1 record? -&lt;/P&gt;&lt;P&gt;abc def ghi&lt;/P&gt;&lt;P&gt;The important thing also is that all blanks must be saved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2022 19:43:59 GMT</pubDate>
    <dc:creator>A1ex777</dc:creator>
    <dc:date>2022-04-11T19:43:59Z</dc:date>
    <item>
      <title>Merge multiple lines into one record</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-multiple-lines-into-one-record/m-p/807238#M318216</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I have dataset with one column that contains a lot of records.&lt;/P&gt;&lt;P&gt;For example the first 3:&lt;/P&gt;&lt;P&gt;abc&lt;/P&gt;&lt;P&gt;&amp;nbsp;def&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; ghi&lt;/P&gt;&lt;P&gt;How can i merge it into 1 record? -&lt;/P&gt;&lt;P&gt;abc def ghi&lt;/P&gt;&lt;P&gt;The important thing also is that all blanks must be saved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 19:43:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-multiple-lines-into-one-record/m-p/807238#M318216</guid>
      <dc:creator>A1ex777</dc:creator>
      <dc:date>2022-04-11T19:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Merge multiple lines into one record</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-multiple-lines-into-one-record/m-p/807242#M318220</link>
      <description>&lt;P&gt;Which spaces need to be preserved?&amp;nbsp; Just the leading spaces?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have end=eof;
  length new_var $300 ;
  new_var = trimn(new_var) || var;
  if eof;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or the trailing spaces that are added to pad the string value to the full length of the variable?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have end=eof;
   length new_var $300 ;
   substr(new_var,(_n_-1)*vlength(var)+1,vlength(var))=var;
  if eof;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you really only want one observation?&amp;nbsp; Why ?&amp;nbsp;Or is there some grouping variable?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have end=eof;
  by id;
  length new_var $300 ;
  if first.id then new_var=' ';
  new_var = trimn(new_var) || var;
  if last.id;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Apr 2022 19:57:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-multiple-lines-into-one-record/m-p/807242#M318220</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-11T19:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: Merge multiple lines into one record</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-multiple-lines-into-one-record/m-p/807243#M318221</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;Tom thanks a lot for quick answer.&lt;BR /&gt;Yes i need both type of spaces.&lt;/P&gt;&lt;P&gt;There's no grouping variable. I just have dataset with column that contains separate records with html text. So i need to store it in one record.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 20:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-multiple-lines-into-one-record/m-p/807243#M318221</guid>
      <dc:creator>A1ex777</dc:creator>
      <dc:date>2022-04-11T20:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Merge multiple lines into one record</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-multiple-lines-into-one-record/m-p/807245#M318223</link>
      <description>&lt;P&gt;That seems silly.&amp;nbsp; Just leave the HTML text as is and then when writing it to an actual HTML file just don't instead any line breaks.&lt;/P&gt;
&lt;P&gt;So if you have a dataset named HAVE with a variable named TEXT that is defined to hold 100 bytes and you want to use it to create a one line HTML file named myfile.html use something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  file 'myfile.html' recfm=n ;
  set have;
  put text $char100.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Apr 2022 20:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-multiple-lines-into-one-record/m-p/807245#M318223</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-11T20:18:26Z</dc:date>
    </item>
  </channel>
</rss>

