<?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 List NonDuplicated Name in the dataset within Comma seperation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744194#M233115</link>
    <description>&lt;P&gt;Good day Experts,&lt;/P&gt;
&lt;P&gt;A&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;created a sample dataset "Have."&amp;nbsp;&amp;nbsp;All the name are seperated with comma in the 'Name' column, however the names in the rows are varous.&amp;nbsp;&amp;nbsp;&amp;nbsp;I would like to list all the nonDuplicated Name shown the 'Want' result.&amp;nbsp; Please let me know how to procede.&amp;nbsp;&amp;nbsp;&amp;nbsp; Thank you.&lt;/P&gt;
&lt;PRE&gt;data Have;  
	length Name $100 ; 
	infile datalines delimiter='/'; 
	input Name;  
	datalines;                     
	John,Marry,Jacob, ,/
	,Ana,Marry,/
	Jacob,John,/
	Will,Tom,Micheal/
;   

data Want;  
	length NameNoDup $100 ; 
	infile datalines delimiter='/'; 
	input NameNoDup;  
	datalines;                     
	John/
	Marry/
	Jacob/
	Ana/
	Will/
	Tom/
	Micheal
;   
&lt;/PRE&gt;</description>
    <pubDate>Thu, 27 May 2021 15:42:48 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2021-05-27T15:42:48Z</dc:date>
    <item>
      <title>List NonDuplicated Name in the dataset within Comma seperation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744194#M233115</link>
      <description>&lt;P&gt;Good day Experts,&lt;/P&gt;
&lt;P&gt;A&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;created a sample dataset "Have."&amp;nbsp;&amp;nbsp;All the name are seperated with comma in the 'Name' column, however the names in the rows are varous.&amp;nbsp;&amp;nbsp;&amp;nbsp;I would like to list all the nonDuplicated Name shown the 'Want' result.&amp;nbsp; Please let me know how to procede.&amp;nbsp;&amp;nbsp;&amp;nbsp; Thank you.&lt;/P&gt;
&lt;PRE&gt;data Have;  
	length Name $100 ; 
	infile datalines delimiter='/'; 
	input Name;  
	datalines;                     
	John,Marry,Jacob, ,/
	,Ana,Marry,/
	Jacob,John,/
	Will,Tom,Micheal/
;   

data Want;  
	length NameNoDup $100 ; 
	infile datalines delimiter='/'; 
	input NameNoDup;  
	datalines;                     
	John/
	Marry/
	Jacob/
	Ana/
	Will/
	Tom/
	Micheal
;   
&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 May 2021 15:42:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744194#M233115</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2021-05-27T15:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: List NonDuplicated Name in the dataset within Comma seperation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744198#M233119</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;  
	length Name $100 ; 
	infile datalines delimiter='/'; 
	input Name;  
	datalines;                     
	John,Marry,Jacob, ,/
	,Ana,Marry,/
	Jacob,John,/
	Will,Tom,Micheal/
;   

data want;
    set have;
    do i=1 to countw(name,',');
        newname=scan(name,i,',');
        output;
    end;
run;
proc sql;
    create table want2 as select distinct newname
    from want where not missing(newname);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This raises the question, why are you creating data sets in such an unusual format? You would make your life much easier by creating a data set with one name per line, rather than many names per line.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 15:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744198#M233119</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-27T15:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: List NonDuplicated Name in the dataset within Comma seperation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744200#M233120</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Good day Experts,&lt;/P&gt;
&lt;P&gt;A&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;created a sample dataset "Have."&amp;nbsp;&amp;nbsp;All the name are seperated with comma in the 'Name' column, however the names in the rows are varous.&amp;nbsp;&amp;nbsp;&amp;nbsp;I would like to list all the nonDuplicated Name shown the 'Want' result.&amp;nbsp; Please let me know how to procede.&amp;nbsp;&amp;nbsp;&amp;nbsp; Thank you.&lt;/P&gt;
&lt;PRE&gt;data Have;  
	length Name $100 ; 
	infile datalines delimiter='/'; 
	input Name;  
	datalines;                     
	John,Marry,Jacob, ,/
	,Ana,Marry,/
	Jacob,John,/
	Will,Tom,Micheal/
;   

data Want;  
	length NameNoDup $100 ; 
	infile datalines delimiter='/'; 
	input NameNoDup;  
	datalines;                     
	John/
	Marry/
	Jacob/
	Ana/
	Will/
	Tom/
	Micheal
;   
&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the order isn't particularly critical&lt;/P&gt;
&lt;PRE&gt;data need;
   set have;
   do i=1 to countw(name);
      onename = scan(name,i);
      if not missing(name) then output;
   end;
   drop i name;
run;

proc sql;
   create table want as
   select distinct onename as name
   from need
   ;
quit;&lt;/PRE&gt;
&lt;P&gt;Default output is likely to be alphabetical by name.&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 15:52:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744200#M233120</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-27T15:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: List NonDuplicated Name in the dataset within Comma seperation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744204#M233123</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;  
	length Name $100 ; 
	infile datalines delimiter=',/' ; 
	input Name @@;  
	datalines;                     
	John,Marry,Jacob, ,/
	,Ana,Marry,/
	Jacob,John,/
	Will,Tom,Micheal/
;  

proc sort data=have nodupkey;
where not missing(compress(trim(name), , 's'));
by name;
run;

proc print data=have;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Read them directly into individual values?&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 15:57:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744204#M233123</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-05-27T15:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: List NonDuplicated Name in the dataset within Comma seperation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744206#M233124</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;  
	length Name $100 ; 
	infile datalines delimiter='/'; 
	input Name;  
	datalines;                     
	John,Marry,Jacob, ,/
	,Ana,Marry,/
	Jacob,John,/
	Will,Tom,Micheal/
;   

data _null_;
 if _n_=1 then do;
  dcl hash h();
  h.definekey('newname');
  h.definedone();
 end;
 set have end=z;
 do _n_=1 to countw(name,',');
   newname=scan(name,_n_,',');
   if newname&amp;gt;' ' then rc=h.add();
 end;
 if z;
 h.output(dataset:'want');
run;

proc print noobs;run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 May 2021 16:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744206#M233124</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-05-27T16:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: List NonDuplicated Name in the dataset within Comma seperation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744266#M233154</link>
      <description>&lt;P&gt;Hi all, I tried all your coding with my actual dataset.&amp;nbsp; For some reason, PaigeMiller's code works better.&amp;nbsp; Thank you so much for all of your time and effort.&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 18:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/List-NonDuplicated-Name-in-the-dataset-within-Comma-seperation/m-p/744266#M233154</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2021-05-27T18:37:22Z</dc:date>
    </item>
  </channel>
</rss>

