<?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: combine observations into one with carriage returns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/combine-observations-into-one-with-carriage-returns/m-p/840317#M332272</link>
    <description>&lt;P&gt;Also the combination of output generator and file destination can impact such things. Proc Report writing to Excel may make additional "breaks" in the data resulting in output that looks more like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Line 1&lt;/P&gt;
&lt;P&gt;- London&lt;BR /&gt;Line 2&lt;/P&gt;
&lt;P&gt;- Liverpool&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I realize that you do not actually want the text "Line 1" in your result. However the approach used if your have longer text with spaces may attempt to break in more places than your desired location. So details do matter such as overall length of text, output generator and file type. Note: if the data set is used for further analysis or manipulation this particular activity may make the remainder of your tasks much harder. For example, what if there are any other variables in the data? What should happen with them?&lt;/P&gt;</description>
    <pubDate>Mon, 24 Oct 2022 15:39:29 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-10-24T15:39:29Z</dc:date>
    <item>
      <title>combine observations into one with carriage returns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combine-observations-into-one-with-carriage-returns/m-p/840288#M332258</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to combine observations and display them with carriage returns:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" width="192"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="width: 48pt; height: 15.0pt;"&gt;Country&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Line&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;City&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;England&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD&gt;London&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;France&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;TD&gt;Paris&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;England&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;TD&gt;Liverpool&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;France&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;TD class="xl66"&gt;Marseille&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 179pt;" width="238"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="width: 48pt; height: 15.0pt;"&gt;Country&lt;/TD&gt;
&lt;TD width="174" style="width: 131pt;"&gt;Combined&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 60.75pt;"&gt;
&lt;TD height="81" style="height: 60.75pt;"&gt;England&lt;/TD&gt;
&lt;TD width="174" class="xl57" style="width: 131pt;"&gt;Line 1 - London&lt;BR /&gt;Line 2 - Liverpool&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 30.75pt;"&gt;
&lt;TD height="41" style="height: 30.75pt;"&gt;France&lt;/TD&gt;
&lt;TD width="174" class="xl57" style="width: 131pt;"&gt;Line 1 - Paris&lt;BR /&gt;Line 2 - Marseille&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 14:21:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combine-observations-into-one-with-carriage-returns/m-p/840288#M332258</guid>
      <dc:creator>arde</dc:creator>
      <dc:date>2022-10-24T14:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: combine observations into one with carriage returns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combine-observations-into-one-with-carriage-returns/m-p/840292#M332259</link>
      <description>&lt;P&gt;Display them where?&lt;/P&gt;
&lt;P&gt;The tool you are using to display the data makes a difference.&lt;/P&gt;
&lt;P&gt;For example PROC REPORT supports the SPLIT character for normal test output but with ODS type output you might need to use other methods.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-split-a-variable-string-in-proc-report/td-p/738283" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/How-to-split-a-variable-string-in-proc-report/td-p/738283&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 14:45:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combine-observations-into-one-with-carriage-returns/m-p/840292#M332259</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-24T14:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: combine observations into one with carriage returns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combine-observations-into-one-with-carriage-returns/m-p/840317#M332272</link>
      <description>&lt;P&gt;Also the combination of output generator and file destination can impact such things. Proc Report writing to Excel may make additional "breaks" in the data resulting in output that looks more like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Line 1&lt;/P&gt;
&lt;P&gt;- London&lt;BR /&gt;Line 2&lt;/P&gt;
&lt;P&gt;- Liverpool&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I realize that you do not actually want the text "Line 1" in your result. However the approach used if your have longer text with spaces may attempt to break in more places than your desired location. So details do matter such as overall length of text, output generator and file type. Note: if the data set is used for further analysis or manipulation this particular activity may make the remainder of your tasks much harder. For example, what if there are any other variables in the data? What should happen with them?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 15:39:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combine-observations-into-one-with-carriage-returns/m-p/840317#M332272</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-10-24T15:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: combine observations into one with carriage returns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combine-observations-into-one-with-carriage-returns/m-p/840491#M332328</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards expandtabs;
input Country $ Line City :$20.;
cards;
England 1 London
France 1 Paris
England 2 Liverpool
France 2 Marseille
;

proc sort data=have out=temp;
by Country  Line;
run;
data want;
 do until(last.Country);
  set temp;
  by Country;
  length combine $ 80;
  combine=catx(' (*ESC*)n ',combine,catx(' ','Line',Line,'-',City));
 end;
 keep Country combine;
run;

proc report data=want nowd;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1666698491429.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76545i9658F4CCAD344EBD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1666698491429.png" alt="Ksharp_0-1666698491429.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 11:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combine-observations-into-one-with-carriage-returns/m-p/840491#M332328</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-10-25T11:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: combine observations into one with carriage returns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combine-observations-into-one-with-carriage-returns/m-p/840509#M332334</link>
      <description>thank you so much!</description>
      <pubDate>Tue, 25 Oct 2022 13:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combine-observations-into-one-with-carriage-returns/m-p/840509#M332334</guid>
      <dc:creator>arde</dc:creator>
      <dc:date>2022-10-25T13:13:23Z</dc:date>
    </item>
  </channel>
</rss>

