<?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: more value in same cell based on one column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/more-value-in-same-cell-based-on-one-column/m-p/445560#M111670</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input (Column1	Column2	Column3) (:$10.);
datalines;
1	AB	14/03/2018
2	DC	23/07/2002
3	NP	13/11/1910
1	LP	25/09/1901
2	JP	06/12/1925
3	QR	03/04/1974
;


data _null_;
length _Column2 _Column3 $100;
if _n_=1 then do;
   dcl hash H (ordered: "A") ;
   h.definekey  ("Column1") ;
   h.definedata ("Column1","_Column2", "_Column3") ;
   h.definedone () ;
   call missing(of _all_);
   end;
set have end=l;
if h.find() ne 0 then h.replace(key:column1,data:Column1,data:Column2,data:Column3);
else do;_Column2=catx('-',_Column2,Column2);
_Column3=catx('-',_Column3,Column3);
h.replace();
end;
if l then h.output(dataset:'want');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 14 Mar 2018 17:47:09 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-03-14T17:47:09Z</dc:date>
    <item>
      <title>more value in same cell based on one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/more-value-in-same-cell-based-on-one-column/m-p/445547#M111660</link>
      <description>&lt;P&gt;I have an input data like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Column1&lt;/TD&gt;&lt;TD&gt;Column2&lt;/TD&gt;&lt;TD&gt;Column3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&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&gt;NP-QR&lt;/TD&gt;&lt;TD&gt;13/11/1910-03/04/1974&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 14 Mar 2018 17:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/more-value-in-same-cell-based-on-one-column/m-p/445547#M111660</guid>
      <dc:creator>Deepankar</dc:creator>
      <dc:date>2018-03-14T17:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: more value in same cell based on one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/more-value-in-same-cell-based-on-one-column/m-p/445551#M111662</link>
      <description>&lt;P&gt;Is it always only 2 per record?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Sort data (PROC SORT)&lt;/P&gt;
&lt;P&gt;2. Use BY/LAST to identify LAST records&lt;/P&gt;
&lt;P&gt;3. Use LAG() to capture previous value&lt;/P&gt;
&lt;P&gt;4. Use CATX()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or Transpose and then use CATX on the output to combine the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Mar 2018 17:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/more-value-in-same-cell-based-on-one-column/m-p/445551#M111662</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-14T17:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: more value in same cell based on one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/more-value-in-same-cell-based-on-one-column/m-p/445560#M111670</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input (Column1	Column2	Column3) (:$10.);
datalines;
1	AB	14/03/2018
2	DC	23/07/2002
3	NP	13/11/1910
1	LP	25/09/1901
2	JP	06/12/1925
3	QR	03/04/1974
;


data _null_;
length _Column2 _Column3 $100;
if _n_=1 then do;
   dcl hash H (ordered: "A") ;
   h.definekey  ("Column1") ;
   h.definedata ("Column1","_Column2", "_Column3") ;
   h.definedone () ;
   call missing(of _all_);
   end;
set have end=l;
if h.find() ne 0 then h.replace(key:column1,data:Column1,data:Column2,data:Column3);
else do;_Column2=catx('-',_Column2,Column2);
_Column3=catx('-',_Column3,Column3);
h.replace();
end;
if l then h.output(dataset:'want');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Mar 2018 17:47:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/more-value-in-same-cell-based-on-one-column/m-p/445560#M111670</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-14T17:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: more value in same cell based on one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/more-value-in-same-cell-based-on-one-column/m-p/445826#M111782</link>
      <description>&lt;PRE&gt;

data have;
input (Column1	Column2	Column3) (:$10.);
datalines;
1	AB	14/03/2018
2	DC	23/07/2002
3	NP	13/11/1910
1	LP	25/09/1901
2	JP	06/12/1925
3	QR	03/04/1974
;
proc sort data=have;
by column1;
run;
data want;
length new2 new3 $ 200;
do until(last.column1);
 set have;
 by column1;
 new2=catx('-',new2,column2);
 new3=catx('-',new3,column3);
end;
drop column2 column3;
run;

&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Mar 2018 13:36:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/more-value-in-same-cell-based-on-one-column/m-p/445826#M111782</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-03-15T13:36:44Z</dc:date>
    </item>
  </channel>
</rss>

