<?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: Consolidated categories in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764375#M242113</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I might suggest sorting that data set by Id and Meds before the hash step.&lt;/P&gt;
&lt;P&gt;Otherwise the (IMHO limited) usefulness of that data structure is compromised because the order of the values means the combinations are not the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example switch the order of the ID=6 in the first step and the result is not the same as for Id=1 with the same values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Aug 2021 23:35:38 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-08-26T23:35:38Z</dc:date>
    <item>
      <title>Consolidated categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764343#M242095</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have a list of different medications that each ID took. I need to consolidate the medications for each ID with a comma and in alphabetical order. There might be repeat/duplicates but they need to be used only once. For example ID#1 has ax1 listed twice but it needs to be used only once i.e. ID #1 was on ax1 and bx2 medications.&lt;/P&gt;
&lt;P&gt;Data Have:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   infile datalines dlm=':';
   input ID Meds :$10.;
 datalines;
1:	ax1
1:	ax1
1:	bx2
2:	cx3
2:	dx4
2:	dx4
3:	ax1
3:	ax1
4:	ax1
4:	bx2
4:	cx3
4:	dx4
5:	cx3
6:	ax1
6:	bx2
7:	ax1
7:	bx2
7:	cx3
7:	dx4
7:	ex5
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl65" style="height: 15.0pt; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="width: 48pt;"&gt;Meds&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65"&gt;bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl65"&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl65"&gt;dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl65"&gt;dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65"&gt;bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65"&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65"&gt;dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;5&lt;/TD&gt;
&lt;TD class="xl65"&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;6&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;6&lt;/TD&gt;
&lt;TD class="xl65"&gt;bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;ex5&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data Want:&lt;/P&gt;
&lt;TABLE width="279"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;ID&lt;/TD&gt;
&lt;TD width="215"&gt;All_Meds&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;ax1, bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;cx3, dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;ax1, bx2, cx3, dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;TD&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;TD&gt;ax1, bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;7&lt;/TD&gt;
&lt;TD&gt;ax1, bx2, cx3, dx4, ex5&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Thu, 26 Aug 2021 23:00:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764343#M242095</guid>
      <dc:creator>newsas007</dc:creator>
      <dc:date>2021-08-26T23:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidated categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764353#M242104</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/336862"&gt;@newsas007&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have a list of different medications that each ID took. I need to consolidate the medications for each ID with a comma and in alphabetical order. There might be repeat/duplicates but they need to be counted only once.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data Have:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   infile datalines dlm=':';
   input ID Meds :$10.;
 datalines;
1:	ax1
1:	ax1
1:	bx2
2:	cx3
2:	dx4
2:	dx4
3:	ax1
3:	ax1
4:	ax1
4:	bx2
4:	cx3
4:	dx4
5:	cx3
6:	ax1
6:	bx2
7:	ax1
7:	bx2
7:	cx3
7:	dx4
7:	ex5
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl65" style="height: 15.0pt; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="width: 48pt;"&gt;Meds&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65"&gt;bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl65"&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl65"&gt;dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl65"&gt;dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65"&gt;bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65"&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65"&gt;dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;5&lt;/TD&gt;
&lt;TD class="xl65"&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;6&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;6&lt;/TD&gt;
&lt;TD class="xl65"&gt;bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;ex5&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data Want:&lt;/P&gt;
&lt;TABLE width="279"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;ID&lt;/TD&gt;
&lt;TD width="215"&gt;All_Meds&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;ax1, bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;cx3, dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;ax1, bx2, cx3, dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;TD&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;TD&gt;ax1, bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;7&lt;/TD&gt;
&lt;TD&gt;ax1, bx2, cx3, dx4, ex5&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't see any "counting".&lt;/P&gt;
&lt;P&gt;Just what are you going to use that compound variable for? It is almost useless for anything except reporting and reporting could provide the same information easier.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 21:40:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764353#M242104</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-26T21:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidated categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764369#M242109</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;: I have edited my post. Hope it makes more sense. All, i am trying to do is to create a dataset with combination of all the medications by ID. thanks&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 23:01:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764369#M242109</guid>
      <dc:creator>newsas007</dc:creator>
      <dc:date>2021-08-26T23:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidated categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764371#M242111</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/336862"&gt;@newsas007&lt;/a&gt;&amp;nbsp; My share of fun-&lt;/P&gt;
&lt;P&gt;Please note, The following is not necessarily the most convenient nor the best for your question. However, i fancied some fun as I haven't been active much here lately. By all means, feel free to wait for a much simpler and convenient one. Have fun!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
   infile datalines dlm=':';
   input ID 1. Meds :$10.;
 datalines;
1:	ax1
1:	ax1
1:	bx2
2:	cx3
2:	dx4
2:	dx4
3:	ax1
3:	ax1
4:	ax1
4:	bx2
4:	cx3
4:	dx4
5:	cx3
6:	ax1
6:	bx2
7:	ax1
7:	bx2
7:	cx3
7:	dx4
7:	ex5
;
Run;

data want;
  if _n_=1 then do;
    dcl hash h();
    h.definekey('meds');
	h.definedone();
  end;
  do until(last.id);
    set have;
	by id;
	if h.check()=0 then continue;
	length all_meds $100;
	All_Meds=catx(', ',All_Meds,meds);
	h.add();
  end;
  h.clear();
  drop meds;
run;

proc print noobs;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;ID&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;all_meds&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="l data"&gt;ax1, bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;TD class="l data"&gt;cx3, dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;TD class="l data"&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;TD class="l data"&gt;ax1, bx2, cx3, dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;5&lt;/TD&gt;
&lt;TD class="l data"&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;6&lt;/TD&gt;
&lt;TD class="l data"&gt;ax1, bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;7&lt;/TD&gt;
&lt;TD class="l data"&gt;ax1, bx2, cx3, dx4, ex5&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 26 Aug 2021 23:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764371#M242111</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-08-26T23:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidated categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764373#M242112</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/336862"&gt;@newsas007&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;: I have edited my post. Hope it makes more sense. All, i am trying to do is to create a dataset with combination of all the medications by ID. thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I ask why that particular form because 1) we seem to get one or more of these requests every week and 2) almost no one will tell me where they they think that particular form of data is particularly useful.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 23:29:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764373#M242112</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-26T23:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidated categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764375#M242113</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I might suggest sorting that data set by Id and Meds before the hash step.&lt;/P&gt;
&lt;P&gt;Otherwise the (IMHO limited) usefulness of that data structure is compromised because the order of the values means the combinations are not the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example switch the order of the ID=6 in the first step and the result is not the same as for Id=1 with the same values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 23:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764375#M242113</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-26T23:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidated categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764376#M242114</link>
      <description>&lt;P&gt;Here is another approach:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   infile datalines dlm=':';
   input ID Meds :$10.;
 datalines;
1:	ax1
1:	ax1
1:	bx2
2:	cx3
2:	dx4
2:	dx4
3:	ax1
3:	ax1
4:	ax1
4:	bx2
4:	cx3
4:	dx4
5:	cx3
6:	ax1
6:	bx2
7:	ax1
7:	bx2
7:	cx3
7:	dx4
7:	ex5
;
run;

proc sort data = have;
  by ID Meds;
run;

data want;
  set have;
  by ID Meds;
  retain All_Meds;
  length All_Meds $ 50; 
  if first.ID then All_Meds = '';
  if first.Meds then All_Meds = catx(',',All_Meds, Meds);
  if last.ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Aug 2021 23:46:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764376#M242114</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-08-26T23:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidated categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764377#M242115</link>
      <description>&lt;P&gt;Agree.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 23:50:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764377#M242115</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-08-26T23:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidated categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764378#M242116</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works great. Just wanted to check how to modify if i add another category. By ID and LOT this time.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   infile datalines dlm=':';
   input ID 1. Meds :$10. LOT: $4.;
 datalines;
1:	ax1: 1
1:	ax1: 2
1:	bx2: 2
2:	cx3: 1
2:	dx4: 2
2:	dx4: 2
3:	ax1: 1
3:	ax1: 2
4:	ax1: 1
4:	bx2: 1
4:	cx3: 2
4:	dx4: 2
5:	cx3: 1
6:	ax1: 2
6:	bx2: 2
7:	ax1: 1
7:	bx2: 1
7:	cx3: 2
7:	dx4: 3
7:	ex5: 3
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Data Have:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl65" style="height: 15.0pt; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="width: 48pt;"&gt;Meds&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="width: 48pt;"&gt;LOT&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;TD class="xl65"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;TD class="xl65"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65"&gt;bx2&lt;/TD&gt;
&lt;TD class="xl65"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl65"&gt;cx3&lt;/TD&gt;
&lt;TD class="xl65"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl65"&gt;dx4&lt;/TD&gt;
&lt;TD class="xl65"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD class="xl65"&gt;dx4&lt;/TD&gt;
&lt;TD class="xl65"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;TD class="xl65"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;TD class="xl65"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;TD class="xl65"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65"&gt;bx2&lt;/TD&gt;
&lt;TD class="xl65"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65"&gt;cx3&lt;/TD&gt;
&lt;TD class="xl65"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65"&gt;dx4&lt;/TD&gt;
&lt;TD class="xl65"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;5&lt;/TD&gt;
&lt;TD class="xl65"&gt;cx3&lt;/TD&gt;
&lt;TD class="xl65"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;6&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;TD class="xl65"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;6&lt;/TD&gt;
&lt;TD class="xl65"&gt;bx2&lt;/TD&gt;
&lt;TD class="xl65"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;ax1&lt;/TD&gt;
&lt;TD class="xl65"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;bx2&lt;/TD&gt;
&lt;TD class="xl65"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;cx3&lt;/TD&gt;
&lt;TD class="xl65"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;dx4&lt;/TD&gt;
&lt;TD class="xl65"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl65" style="height: 15.0pt;"&gt;7&lt;/TD&gt;
&lt;TD class="xl65"&gt;ex5&lt;/TD&gt;
&lt;TD class="xl65"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data Want:&lt;/P&gt;
&lt;TABLE width="343"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;ID&lt;/TD&gt;
&lt;TD width="64"&gt;LOT&lt;/TD&gt;
&lt;TD width="215"&gt;All_Meds&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;ax1, bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;ax1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;ax1, bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;cx3, dx4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;ax1, bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;7&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;ax1, bx2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;7&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;cx3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;7&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;dx4, ex5&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Thu, 26 Aug 2021 23:56:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764378#M242116</guid>
      <dc:creator>newsas007</dc:creator>
      <dc:date>2021-08-26T23:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidated categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764379#M242117</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/336862"&gt;@newsas007&lt;/a&gt;&amp;nbsp; Please try sorting the data first&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;nbsp; &amp;nbsp;by id lot;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then change the code to-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  do until(last.lot);
    set have;
	by id lot;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 00:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Consolidated-categories/m-p/764379#M242117</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-08-27T00:10:48Z</dc:date>
    </item>
  </channel>
</rss>

