<?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: How to get the distinct values of all columns for a row into another column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-distinct-values-of-all-columns-for-a-row-into/m-p/685120#M207744</link>
    <description>&lt;P&gt;Turn the duplicates into missing values (empty strings) and concatenate what's left.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array a v1-v5;
do i = 2 to dim(a);
    if whichc(a{i}, of a{*}) &amp;lt; i then call missing(a{i});
    end;
length x $10;
x = catx("/", of a{*});
drop i v:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 19 Sep 2020 03:02:36 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2020-09-19T03:02:36Z</dc:date>
    <item>
      <title>How to get the distinct values of all columns for a row into another column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-distinct-values-of-all-columns-for-a-row-into/m-p/685117#M207743</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the example data.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data have;&lt;BR /&gt;infile datalines missover;&lt;BR /&gt;informat v1 -v5 $2.;&lt;BR /&gt;input v1-v5;&lt;BR /&gt;cards;&lt;BR /&gt;A A B A A&lt;BR /&gt;X A Y X Y&lt;BR /&gt;S M K H A&lt;BR /&gt;X A X&lt;BR /&gt;A B B&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I want to get the result in another column V6:&lt;BR /&gt;first row : A/B&lt;BR /&gt;Second row: X/A/Y&lt;BR /&gt;Third Row : S/M/K/H/A&lt;BR /&gt;Fourth Row: X/A&lt;BR /&gt;Fifth Row : A/B&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 22:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-distinct-values-of-all-columns-for-a-row-into/m-p/685117#M207743</guid>
      <dc:creator>shari</dc:creator>
      <dc:date>2020-09-18T22:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the distinct values of all columns for a row into another column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-distinct-values-of-all-columns-for-a-row-into/m-p/685120#M207744</link>
      <description>&lt;P&gt;Turn the duplicates into missing values (empty strings) and concatenate what's left.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array a v1-v5;
do i = 2 to dim(a);
    if whichc(a{i}, of a{*}) &amp;lt; i then call missing(a{i});
    end;
length x $10;
x = catx("/", of a{*});
drop i v:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Sep 2020 03:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-distinct-values-of-all-columns-for-a-row-into/m-p/685120#M207744</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-09-19T03:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the distinct values of all columns for a row into another column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-distinct-values-of-all-columns-for-a-row-into/m-p/685182#M207775</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines missover;
informat v1 -v5 $2.;
input v1-v5;
cards;
A A B A A
X A Y X Y
S M K H A
X A X
A B B
;
data want;
 set have;
 array x{5} $ 1 ;
 array v{5} $;
 n=0;
 do i=1 to dim(v);
  if v{i} not in x then do;n+1;x{n}=v{i};end;
 end;
 want=catx('/',of x{*});
 drop n i x: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Sep 2020 12:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-distinct-values-of-all-columns-for-a-row-into/m-p/685182#M207775</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-09-19T12:08:12Z</dc:date>
    </item>
  </channel>
</rss>

