<?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: Adding multiple rows of data and display in one row based on ID in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Adding-multiple-rows-of-data-and-display-in-one-row-based-on-ID/m-p/816500#M322300</link>
    <description>&lt;P&gt;Just another way --&lt;BR /&gt;&lt;BR /&gt;data have;&lt;BR /&gt;input ID DESC $2.;&lt;BR /&gt;datalines;&lt;BR /&gt;1234 AB&lt;BR /&gt;5678 CD&lt;BR /&gt;5678 EF&lt;BR /&gt;9999 GH&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc transpose data=have out=have_t(drop=_:);&lt;BR /&gt;by id;&lt;BR /&gt;var DESC;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data want(drop=col:);&lt;BR /&gt;set have_t;&lt;BR /&gt;desc=catx("_", of col:);&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Sat, 04 Jun 2022 15:19:30 GMT</pubDate>
    <dc:creator>nikhilwagh</dc:creator>
    <dc:date>2022-06-04T15:19:30Z</dc:date>
    <item>
      <title>Adding multiple rows of data and display in one row based on ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-multiple-rows-of-data-and-display-in-one-row-based-on-ID/m-p/816373#M322217</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Struggling with the below. Basically I shouldn't be having multiple rows of same id. At the same time, their corresponding values of 'Desc' filed, has to be combined.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data have:&lt;BR /&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Desc&lt;/P&gt;&lt;P&gt;1234&amp;nbsp; &amp;nbsp; AB&lt;BR /&gt;5678&amp;nbsp; &amp;nbsp; CD&lt;BR /&gt;5678&amp;nbsp; &amp;nbsp; &amp;nbsp;EF&lt;BR /&gt;9999&amp;nbsp; &amp;nbsp; &amp;nbsp;GH&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data want:&lt;BR /&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Desc&lt;BR /&gt;1234&amp;nbsp; &amp;nbsp; AB&lt;BR /&gt;5678&amp;nbsp; &amp;nbsp;CD_EF&lt;BR /&gt;9999&amp;nbsp; &amp;nbsp; GH&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 17:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-multiple-rows-of-data-and-display-in-one-row-based-on-ID/m-p/816373#M322217</guid>
      <dc:creator>West26</dc:creator>
      <dc:date>2022-06-03T17:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple rows of data and display in one row based on ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-multiple-rows-of-data-and-display-in-one-row-based-on-ID/m-p/816423#M322246</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID DESC $2.;
datalines;
1234 AB
5678 CD
5678 EF
9999 GH
run;

data want(keep=id list);
  do until (last.id);
    set have;
    by id;
    length list $30;    
    list = catx('_',list,desc);
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;gives&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="147px" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD width="58.2321px" height="17" style="height: 12.75pt; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="68.7679px" style="width: 48pt;"&gt;list&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD width="58.2321px" height="17" align="right" style="height: 12.75pt;"&gt;1234&lt;/TD&gt;
&lt;TD width="68.7679px"&gt;AB&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD width="58.2321px" height="17" align="right" style="height: 12.75pt;"&gt;5678&lt;/TD&gt;
&lt;TD width="68.7679px"&gt;CD_EF&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 12.75pt;"&gt;
&lt;TD width="58.2321px" height="17" align="right" style="height: 12.75pt;"&gt;9999&lt;/TD&gt;
&lt;TD width="68.7679px"&gt;GH&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not my code.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/td-p/646925" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/td-p/646925&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 20:25:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-multiple-rows-of-data-and-display-in-one-row-based-on-ID/m-p/816423#M322246</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2022-06-03T20:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple rows of data and display in one row based on ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-multiple-rows-of-data-and-display-in-one-row-based-on-ID/m-p/816496#M322297</link>
      <description>&lt;P&gt;Hello HB,&lt;/P&gt;&lt;P&gt;Thanks for taking your time and providing the solution. Appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jun 2022 11:38:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-multiple-rows-of-data-and-display-in-one-row-based-on-ID/m-p/816496#M322297</guid>
      <dc:creator>West26</dc:creator>
      <dc:date>2022-06-04T11:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Adding multiple rows of data and display in one row based on ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-multiple-rows-of-data-and-display-in-one-row-based-on-ID/m-p/816500#M322300</link>
      <description>&lt;P&gt;Just another way --&lt;BR /&gt;&lt;BR /&gt;data have;&lt;BR /&gt;input ID DESC $2.;&lt;BR /&gt;datalines;&lt;BR /&gt;1234 AB&lt;BR /&gt;5678 CD&lt;BR /&gt;5678 EF&lt;BR /&gt;9999 GH&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc transpose data=have out=have_t(drop=_:);&lt;BR /&gt;by id;&lt;BR /&gt;var DESC;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data want(drop=col:);&lt;BR /&gt;set have_t;&lt;BR /&gt;desc=catx("_", of col:);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jun 2022 15:19:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-multiple-rows-of-data-and-display-in-one-row-based-on-ID/m-p/816500#M322300</guid>
      <dc:creator>nikhilwagh</dc:creator>
      <dc:date>2022-06-04T15:19:30Z</dc:date>
    </item>
  </channel>
</rss>

