<?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 Concatenation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/481546#M124584</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help in concatenation.&lt;/P&gt;&lt;P&gt;I have two variables : ID Agent and Agentoth (all CHAR)&lt;/P&gt;&lt;P&gt;Sample data:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01 Steriods&amp;nbsp; &amp;nbsp; &amp;nbsp;ABC&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;02 Other&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XYZ&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;03 ATG&lt;/P&gt;&lt;P&gt;Expected out put is : Agent,agentoth&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data med;
     by ID;
     attrib AGENT_ length=$100;

if index(lowcase(AGENT),"other")&amp;gt;0 then do;
		AGENT_= "Other, "|| AGENTOTH; 
 	end;
 	if AGENT_ =" " then AGENT_ = AGENT;

	output step_01_dat_final;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This code above concatenates&amp;nbsp;only if the agent name is 'Other'. I need to concatenate if there is anything in the Agenoth, else leave.&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nasya&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jul 2018 15:13:54 GMT</pubDate>
    <dc:creator>Nasya</dc:creator>
    <dc:date>2018-07-26T15:13:54Z</dc:date>
    <item>
      <title>Concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/481546#M124584</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help in concatenation.&lt;/P&gt;&lt;P&gt;I have two variables : ID Agent and Agentoth (all CHAR)&lt;/P&gt;&lt;P&gt;Sample data:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01 Steriods&amp;nbsp; &amp;nbsp; &amp;nbsp;ABC&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;02 Other&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XYZ&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;03 ATG&lt;/P&gt;&lt;P&gt;Expected out put is : Agent,agentoth&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data med;
     by ID;
     attrib AGENT_ length=$100;

if index(lowcase(AGENT),"other")&amp;gt;0 then do;
		AGENT_= "Other, "|| AGENTOTH; 
 	end;
 	if AGENT_ =" " then AGENT_ = AGENT;

	output step_01_dat_final;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This code above concatenates&amp;nbsp;only if the agent name is 'Other'. I need to concatenate if there is anything in the Agenoth, else leave.&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nasya&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 15:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/481546#M124584</guid>
      <dc:creator>Nasya</dc:creator>
      <dc:date>2018-07-26T15:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/481559#M124591</link>
      <description>&lt;P&gt;I believe the CAT_ family of functions do that automatically, so you don't need to account for that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover;
input id $ agent $ agentoth $;
cards;
1 Fred Flinstone
2 Angela
3 Barney Rubble
;;
run;

data want;
set have;

var = catx(', ', agent, agentoth);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/211652"&gt;@Nasya&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need help in concatenation.&lt;/P&gt;
&lt;P&gt;I have two variables : ID Agent and Agentoth (all CHAR)&lt;/P&gt;
&lt;P&gt;Sample data:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01 Steriods&amp;nbsp; &amp;nbsp; &amp;nbsp;ABC&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;02 Other&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XYZ&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;03 ATG&lt;/P&gt;
&lt;P&gt;Expected out put is : Agent,agentoth&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data med;
     by ID;
     attrib AGENT_ length=$100;

if index(lowcase(AGENT),"other")&amp;gt;0 then do;
		AGENT_= "Other, "|| AGENTOTH; 
 	end;
 	if AGENT_ =" " then AGENT_ = AGENT;

	output step_01_dat_final;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This code above concatenates&amp;nbsp;only if the agent name is 'Other'. I need to concatenate if there is anything in the Agenoth, else leave.&lt;/P&gt;
&lt;P&gt;Any suggestions?&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nasya&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 15:31:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenation/m-p/481559#M124591</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-26T15:31:18Z</dc:date>
    </item>
  </channel>
</rss>

