<?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: concatenate reasons to bad in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/concatenate-reasons-to-bad/m-p/892540#M352511</link>
    <description>&lt;P&gt;Here's a way to get rid of the extra ||.&amp;nbsp; Switch from COMPRESS to CATX:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
If X1=1 then Reasons=catx('||', Reasons, 'Health_issue');
If X2=1 then Reasons=catx('||', Reasons, 'Wealth_issue');
If X3=1 then Reasons=catx('||', Reasons, 'Other_issue');
IF X1=0 AND X2=0 AND X3=0 then Reasons='No_Reasons';&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 04 Sep 2023 12:04:59 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2023-09-04T12:04:59Z</dc:date>
    <item>
      <title>concatenate reasons to bad</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-reasons-to-bad/m-p/892532#M352504</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to create a new column that concatenate reasons.&lt;/P&gt;
&lt;P&gt;My question-&lt;/P&gt;
&lt;P&gt;In the resulted concatenated column there is sign "||" at the end and I dont want to have it.&lt;/P&gt;
&lt;P&gt;What is the way to modify the code to prevent "||" sign at end of the string?&lt;/P&gt;
&lt;P&gt;Please note that I want to have "||" between reasons but not in end.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have;
input ID  X1 X2 X3 ;
cards;
1 1 0 0
2 0 0 0
3 1 1 0
4 0 0 1
5 0 1 0
6 1 1 1
7 0 0 0
8 0 1 1
9 0 1 0
10 0 0 1
;
Run;

Data want;
length Reasons  $100.;
set have;
Reasons='';
If X1=1 then Reasons=compress(Reasons||'Health_issue||');
If X2=1 then Reasons=compress(Reasons||'Wealth_issue||');
If X3=1 then Reasons=compress(Reasons||'Other_issue||');
IF X1=0 AND X2=0 AND X3=0 then Reasons='No_Reasons';
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Sep 2023 11:18:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-reasons-to-bad/m-p/892532#M352504</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2023-09-04T11:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate reasons to bad</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-reasons-to-bad/m-p/892540#M352511</link>
      <description>&lt;P&gt;Here's a way to get rid of the extra ||.&amp;nbsp; Switch from COMPRESS to CATX:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
If X1=1 then Reasons=catx('||', Reasons, 'Health_issue');
If X2=1 then Reasons=catx('||', Reasons, 'Wealth_issue');
If X3=1 then Reasons=catx('||', Reasons, 'Other_issue');
IF X1=0 AND X2=0 AND X3=0 then Reasons='No_Reasons';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Sep 2023 12:04:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-reasons-to-bad/m-p/892540#M352511</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-09-04T12:04:59Z</dc:date>
    </item>
  </channel>
</rss>

