<?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: one rwo per id in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/one-rwo-per-id/m-p/447963#M112616</link>
    <description>&lt;P&gt;there are many similar answers in this communities. one is below link.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/Concatenate-multiple-rows-into-a-single-value/td-p/132882" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/Concatenate-multiple-rows-into-a-single-value/td-p/132882&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Mar 2018 21:24:44 GMT</pubDate>
    <dc:creator>kiranv_</dc:creator>
    <dc:date>2018-03-22T21:24:44Z</dc:date>
    <item>
      <title>one rwo per id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/one-rwo-per-id/m-p/447951#M112611</link>
      <description>&lt;P&gt;If there are multiple records per id, how to make it as one record as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id&amp;nbsp;&amp;nbsp;&amp;nbsp; brand&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;123&amp;nbsp;&amp;nbsp; iphone&lt;BR /&gt;234&amp;nbsp;&amp;nbsp; samsung&lt;BR /&gt;234&amp;nbsp;&amp;nbsp; iphone&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;id&amp;nbsp; brand&lt;BR /&gt;123 iphone&lt;BR /&gt;234 samsung | iphone&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 21:03:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/one-rwo-per-id/m-p/447951#M112611</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2018-03-22T21:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: one rwo per id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/one-rwo-per-id/m-p/447962#M112615</link>
      <description>&lt;P&gt;Here's two different ways:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*create sample data for demonstration;
data have;
    infile cards dlm='09'x;
    input OrgID Product $   States $;
    cards;
1   football    DC
1   football    VA
1   football    MD
2   football    CA
3   football    NV
3   football    CA
;
run;

*Sort - required for both options;
proc sort data=have;
    by orgID;
run;

**********************************************************************;
*Use RETAIN and BY group processing to combine the information;
**********************************************************************;
data want_option1;
    set have;
    by orgID;
    length combined $100.;
    retain combined;

    if first.orgID then
        combined=states;
    else
        combined=catx(', ', combined, states);

    if last.orgID then
        output;
run;

**********************************************************************;
*Transpose it to a wide format and then combine into a single field;
**********************************************************************;
proc transpose data=have out=wide prefix=state_;
    by orgID;
    var states;
run;

data want_option2;
    set wide;
    length combined $100.;
    combined=catx(', ', of state_:);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Mar 2018 21:24:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/one-rwo-per-id/m-p/447962#M112615</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-22T21:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: one rwo per id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/one-rwo-per-id/m-p/447963#M112616</link>
      <description>&lt;P&gt;there are many similar answers in this communities. one is below link.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/Concatenate-multiple-rows-into-a-single-value/td-p/132882" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/Concatenate-multiple-rows-into-a-single-value/td-p/132882&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Mar 2018 21:24:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/one-rwo-per-id/m-p/447963#M112616</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-03-22T21:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: one rwo per id</title>
      <link>https://communities.sas.com/t5/SAS-Programming/one-rwo-per-id/m-p/448261#M112755</link>
      <description>&lt;P&gt;You can use first.id for top most record or last.id for last record.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;doing proc sort before this step will give better results.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 17:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/one-rwo-per-id/m-p/448261#M112755</guid>
      <dc:creator>SASUser_22</dc:creator>
      <dc:date>2018-03-23T17:48:52Z</dc:date>
    </item>
  </channel>
</rss>

