<?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: concatenate contents from the same column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959048#M374249</link>
    <description>&lt;P&gt;May I ask why you need to do this? What is wrong with leaving the data as it is and working with it in the long arrangement?&lt;/P&gt;</description>
    <pubDate>Wed, 12 Feb 2025 15:33:26 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2025-02-12T15:33:26Z</dc:date>
    <item>
      <title>concatenate contents from the same column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959040#M374247</link>
      <description>&lt;P&gt;Good day community .&lt;BR /&gt;&lt;BR /&gt;i want to concatenate contents from the same column.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;dataset (&lt;CODE&gt;test&lt;/CODE&gt;) looks like:&lt;/P&gt;&lt;P&gt;Customer_Num Product_Category_Desc&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;7293&lt;/TD&gt;&lt;TD&gt;MUTUAL FUND INVESTMENTS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7293&lt;/TD&gt;&lt;TD&gt;NOTICE INVESTMENTS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7293&lt;/TD&gt;&lt;TD&gt;SERVICE PRODUCT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7293&lt;/TD&gt;&lt;TD&gt;UNCATEGORISED&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;53916&lt;/TD&gt;&lt;TD&gt;CARD BASED SAVINGS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;53916&lt;/TD&gt;&lt;TD&gt;DEMAND DEPOSITS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;53916&lt;/TD&gt;&lt;TD&gt;DEMAND INVESTMENTS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;53916&lt;/TD&gt;&lt;TD&gt;FIXED INVESTMENTS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;53916&lt;/TD&gt;&lt;TD&gt;SERVICE PRODUCT&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output table (&lt;CODE&gt;combined&lt;/CODE&gt;) will be:&lt;/P&gt;&lt;P&gt;Customer_Num prod_id_combined&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;7293&lt;/TD&gt;&lt;TD&gt;MUTUAL FUND INVESTMENTS, NOTICE INVESTMENTS, SERVICE PRODUCT, UNCATEGORISED&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;53916&lt;/TD&gt;&lt;TD&gt;CARD BASED SAVINGS, DEMAND DEPOSITS, DEMAND INVESTMENTS, FIXED INVESTMENTS, SERVICE PRODUCT&lt;PRE&gt;code to produce the expected outcome.

proc sql;
   create table combined as 
   select Customer_Num, 
          catx(', ', Product_Category_Desc) as prod_id_combined
   from (select distinct Customer_Num, Product_Category_Desc 
         from test)
   group by Customer_Num;
quit;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 12 Feb 2025 14:48:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959040#M374247</guid>
      <dc:creator>VALLY</dc:creator>
      <dc:date>2025-02-12T14:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate contents from the same column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959048#M374249</link>
      <description>&lt;P&gt;May I ask why you need to do this? What is wrong with leaving the data as it is and working with it in the long arrangement?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 15:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959048#M374249</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-02-12T15:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate contents from the same column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959051#M374250</link>
      <description>&lt;P&gt;i want to have a view of a distinct customer based on all the products in one columns , i hope i have answered your question&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 15:38:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959051#M374250</guid>
      <dc:creator>VALLY</dc:creator>
      <dc:date>2025-02-12T15:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate contents from the same column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959052#M374251</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have; by customer_num product_category_desc; run;

data want;
set have;
by customer_num product_category_desc;
length all_descrip $1000;
array T {100} $150 _temporary_;
if first.customer_num then do;
    call missing(of T[*]);
    recnum=0;
end;
if first.product_category_desc then do;
    recnum+1;
    T[recnum]=product_category_desc;
end;
if last.customer_num then all_descrip=catx(',', of T[*]);
keep customer_num all_descrip;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If any customer has more than 100 unique products, then update the {100} part above to whatever that maximum number is.&amp;nbsp; And if any of the product descriptions are more than 150 characters in length, update the $150 to that maximum length.&amp;nbsp; Otherwise, you can safely leave as-is.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 15:41:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959052#M374251</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-02-12T15:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate contents from the same column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959053#M374252</link>
      <description>&lt;P&gt;Is that it, you just all the text concatenated for a customer, and that's the end of the project? Or are you planning to do analysis once you have that? If so, what types of analysis?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 15:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959053#M374252</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-02-12T15:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: concatenate contents from the same column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959062#M374254</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;seems to be saying, though, the result of this is likely to be hard to use for any analysis.&amp;nbsp; If you really want to collapse this to one row per person, then I would suggest you start by &lt;EM&gt;making a variable for each of your unique product descriptions&lt;/EM&gt; (e.g., make variables like "mutual_fund_investments", etc.), then populate each of those variables with a 0 or 1 depending on whether the customer had that product.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 15:59:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenate-contents-from-the-same-column/m-p/959062#M374254</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2025-02-12T15:59:38Z</dc:date>
    </item>
  </channel>
</rss>

