<?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: A string with a &amp;quot;/&amp;quot; delimiter has to be converted to indiviual value and find the dist in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-string-with-a-quot-quot-delimiter-has-to-be-converted-to/m-p/489773#M127957</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input (Customer_id	PART_N	PART_C	TXN_ID) (:$50.)	;
cards;
B123	268888	7902/7900	159
B123	12839	82900/G8900	1278
B869	12839	8203/890025/7902	17890
B290	268888	62820/12839	179018
;

data temp;
set have;
part=part_n;
output;
do _n_=1 to countw(part_c,'/');
part=scan(part_c,_n_,'/');
output;
end;
keep part Customer_id txn_id;
run;

proc sql;
create table want as
select part,COUNT(Distinct Customer_id) as Distinct_Customer_id,COUNT(Distinct TXN_ID)as Distinct_TXN_ID
from temp
group by part;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 Aug 2018 21:07:41 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-08-24T21:07:41Z</dc:date>
    <item>
      <title>A string with a "/" delimiter has to be converted to indiviual value and find the distinct ids</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-string-with-a-quot-quot-delimiter-has-to-be-converted-to/m-p/489771#M127955</link>
      <description>&lt;P&gt;My data set is like this&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Customer_id&lt;/TD&gt;&lt;TD&gt;PART_N&lt;/TD&gt;&lt;TD&gt;PART_C&lt;/TD&gt;&lt;TD&gt;TXN_ID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B123&lt;/TD&gt;&lt;TD&gt;268888&lt;/TD&gt;&lt;TD&gt;7902/7900&lt;/TD&gt;&lt;TD&gt;159&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B123&lt;/TD&gt;&lt;TD&gt;12839&lt;/TD&gt;&lt;TD&gt;82900/G8900&lt;/TD&gt;&lt;TD&gt;1278&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B869&lt;/TD&gt;&lt;TD&gt;12839&lt;/TD&gt;&lt;TD&gt;8203/890025/7902&lt;/TD&gt;&lt;TD&gt;17890&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B290&lt;/TD&gt;&lt;TD&gt;268888&lt;/TD&gt;&lt;TD&gt;62820/12839&lt;/TD&gt;&lt;TD&gt;179018&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to achieve this&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Part&lt;/TD&gt;&lt;TD&gt;COUNT(Distinct Customer_id)&lt;/TD&gt;&lt;TD&gt;COUNT(Distinct TXN_ID)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;268888&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12839&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7902&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7900&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;82900&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;G8900&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8203&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;890025&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;62820&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;So basically&amp;nbsp;I am looking to split the Part_C to indiviual and combine with PART_N and find distinct (customer_id) and distinct(TXN_ID).&lt;/P&gt;&lt;P&gt;I have a list of distinct part numbers in a dataset (table2). If it was just PART_N then finding &lt;SPAN&gt;distinct (customer_id) and distinct(TXN_ID) would have been straight forward. SAS EG-7.12&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Aug 2018 20:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-string-with-a-quot-quot-delimiter-has-to-be-converted-to/m-p/489771#M127955</guid>
      <dc:creator>Vk_2</dc:creator>
      <dc:date>2018-08-24T20:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: A string with a "/" delimiter has to be converted to indiviual value and find the dist</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-string-with-a-quot-quot-delimiter-has-to-be-converted-to/m-p/489773#M127957</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input (Customer_id	PART_N	PART_C	TXN_ID) (:$50.)	;
cards;
B123	268888	7902/7900	159
B123	12839	82900/G8900	1278
B869	12839	8203/890025/7902	17890
B290	268888	62820/12839	179018
;

data temp;
set have;
part=part_n;
output;
do _n_=1 to countw(part_c,'/');
part=scan(part_c,_n_,'/');
output;
end;
keep part Customer_id txn_id;
run;

proc sql;
create table want as
select part,COUNT(Distinct Customer_id) as Distinct_Customer_id,COUNT(Distinct TXN_ID)as Distinct_TXN_ID
from temp
group by part;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Aug 2018 21:07:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-string-with-a-quot-quot-delimiter-has-to-be-converted-to/m-p/489773#M127957</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-08-24T21:07:41Z</dc:date>
    </item>
  </channel>
</rss>

