<?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: Help to remain only distinct values in a row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693959#M211613</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input ID var $;
cards;
1 AABI
2 TIBBC
3 TTIBTIC
;

data want ;
 if _n_=1 then do;
   dcl hash H () ;
   h.definekey  ("k") ;
   h.definedone () ;
 end;
 set have;
 length var_new $30;
 do _n_=1 to lengthn(var);
  k= char(var,_n_);
  if h.check()=0 then continue;
  var_new=cats(var_new,k);
  h.add();
 end;
 h.clear();
 drop k;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 24 Oct 2020 03:12:50 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-10-24T03:12:50Z</dc:date>
    <item>
      <title>Help to remain only distinct values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693952#M211610</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;
&lt;P&gt;I would like to get only the distinct values for a new variable.&lt;/P&gt;
&lt;P&gt;for example,&lt;/P&gt;
&lt;P&gt;ID var&lt;/P&gt;
&lt;P&gt;1 AABI&lt;/P&gt;
&lt;P&gt;2 TIBBC&lt;/P&gt;
&lt;P&gt;3 TTIBTIC&lt;/P&gt;
&lt;P&gt;so I would like to have a the new variable as output below:&lt;/P&gt;
&lt;P&gt;ID var var_new&lt;/P&gt;
&lt;P&gt;1 AABI ABI&lt;/P&gt;
&lt;P&gt;2 TIBBC TIBC&lt;/P&gt;
&lt;P&gt;3&amp;nbsp;TTIBTIC TIBC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Oct 2020 02:15:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693952#M211610</guid>
      <dc:creator>Stu_J</dc:creator>
      <dc:date>2020-10-24T02:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Help to remain only distinct values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693953#M211611</link>
      <description>&lt;P&gt;What about ABAI?&amp;nbsp; I has 2 A's, but they are not contiguous.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Oct 2020 02:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693953#M211611</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-10-24T02:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help to remain only distinct values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693956#M211612</link>
      <description>Only keeping the distinct values, so ABAI new variable will be ABI&lt;BR /&gt;</description>
      <pubDate>Sat, 24 Oct 2020 02:58:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693956#M211612</guid>
      <dc:creator>Stu_J</dc:creator>
      <dc:date>2020-10-24T02:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help to remain only distinct values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693959#M211613</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input ID var $;
cards;
1 AABI
2 TIBBC
3 TTIBTIC
;

data want ;
 if _n_=1 then do;
   dcl hash H () ;
   h.definekey  ("k") ;
   h.definedone () ;
 end;
 set have;
 length var_new $30;
 do _n_=1 to lengthn(var);
  k= char(var,_n_);
  if h.check()=0 then continue;
  var_new=cats(var_new,k);
  h.add();
 end;
 h.clear();
 drop k;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Oct 2020 03:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693959#M211613</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-10-24T03:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help to remain only distinct values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693964#M211614</link>
      <description>&lt;P&gt;thanks, I don't have much knowledge with hash object. that's very nice.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Oct 2020 04:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693964#M211614</guid>
      <dc:creator>Stu_J</dc:creator>
      <dc:date>2020-10-24T04:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help to remain only distinct values in a row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693989#M211624</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input ID var $;
cards;
1 AABI
2 TIBBC
3 TTIBTIC
;
data want;
 set have;
 array x{100} $ 1 _temporary_;
 n=0;call missing(of x{*});
 do i=1 to length(var);
   temp=char(var,i);
   if temp not in x then do;n+1;x{n}=temp;end;
 end;
 want=cats(of x{*});
 drop n i temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Oct 2020 11:56:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-to-remain-only-distinct-values-in-a-row/m-p/693989#M211624</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-10-24T11:56:20Z</dc:date>
    </item>
  </channel>
</rss>

