<?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: How to create a comma separated String from values from a variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/647087#M193621</link>
    <description>&lt;P&gt;Extraneous SET was an artifact for earlier typing... edited out.&lt;/P&gt;</description>
    <pubDate>Tue, 12 May 2020 13:18:38 GMT</pubDate>
    <dc:creator>RichardDeVen</dc:creator>
    <dc:date>2020-05-12T13:18:38Z</dc:date>
    <item>
      <title>How to create a comma separated String from values from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646925#M193560</link>
      <description>&lt;P&gt;I have a Table with variable A and B with 5 obs. I am trying to create a string with values concatenated from the variable B into one string grouped by variable A&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;A1 = 123; B1 = "XXX";&lt;/P&gt;
&lt;P&gt;A2 = 123; B2 = 'YYY';&lt;/P&gt;
&lt;P&gt;A3 = 456; B3 = 'ZZZ';&lt;/P&gt;
&lt;P&gt;A4 = 456; B4 = 'PPP';&lt;/P&gt;
&lt;P&gt;A5 = 456; B5 = 'OOO'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Driven by 2 distinct values stored in variable A;&amp;nbsp; two observations of variable Joined_Variable should be created from variable B.&lt;/P&gt;
&lt;P&gt;Joined_Variable = 'XXX, YYY'&lt;/P&gt;
&lt;P&gt;Joined_Variable&amp;nbsp; = 'ZZZ, PPP, OOO'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your kind help.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 02:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646925#M193560</guid>
      <dc:creator>Apprentice</dc:creator>
      <dc:date>2020-05-12T02:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a comma separated String from values from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646935#M193566</link>
      <description>There are two methods illustrated here:&lt;BR /&gt;&lt;A href="https://gist.github.com/statgeek/d583cfa992bf56da51d435165b07e96a" target="_blank"&gt;https://gist.github.com/statgeek/d583cfa992bf56da51d435165b07e96a&lt;/A&gt;</description>
      <pubDate>Tue, 12 May 2020 02:39:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646935#M193566</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-12T02:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a comma separated String from values from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646940#M193569</link>
      <description>&lt;P&gt;Accumulate a concatenation over the group and implicit output of one row per group&lt;/P&gt;
&lt;PRE&gt;data have;
input A B $; datalines;
123 XXX
123 YYY
456 ZZZ
456 PPP
456 OOO
run;

data want(keep=A list);
  do until (last.A);
    set have;
    by A;
    length list $30;     * declarative statement (in PDV column will be after(right of) columns of data set), value is implicitly reset at top of step;&lt;BR /&gt;    list = catx(', ',list,B);
  end;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 May 2020 13:19:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646940#M193569</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-05-12T13:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a comma separated String from values from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646941#M193570</link>
      <description>&lt;P&gt;Another example of the gaping need for a few functions as requested &lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/Add-GROUP-CONCAT-function-to-proc-sql/idi-p/323092" target="_self"&gt;here&lt;/A&gt; and &lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/create-string-summary-functions/idi-p/288035" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 02:55:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646941#M193570</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-05-12T02:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a comma separated String from values from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646977#M193583</link>
      <description>&lt;P&gt;Thanks Richard. Worked like a charm.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 06:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646977#M193583</guid>
      <dc:creator>Apprentice</dc:creator>
      <dc:date>2020-05-12T06:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a comma separated String from values from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646978#M193584</link>
      <description>&lt;P&gt;Thank you Rezza. Great solutions. Both would work like a charm. Much appreciate your help.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 06:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646978#M193584</guid>
      <dc:creator>Apprentice</dc:creator>
      <dc:date>2020-05-12T06:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a comma separated String from values from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646999#M193589</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12477"&gt;@RichardDeVen&lt;/a&gt;&amp;nbsp;Why not simply&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(keep=A list);
  do until (last.A);
    set have;
    by A;
    length list $30;    
    list = catx(', ',list,B);
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 08:45:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/646999#M193589</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-05-12T08:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a comma separated String from values from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/647087#M193621</link>
      <description>&lt;P&gt;Extraneous SET was an artifact for earlier typing... edited out.&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 13:18:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-comma-separated-String-from-values-from-a/m-p/647087#M193621</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-05-12T13:18:38Z</dc:date>
    </item>
  </channel>
</rss>

