<?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: Combine multiple observations into one if they have the same Id in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/492851#M72243</link>
    <description>&lt;P&gt;Hi Peter,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the code! It works and I don't know why. Can you help to explain step by step for your code with following sample data (name &lt;STRONG&gt;have&lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Key Data&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; A1&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp;B1&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp;B2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result based on your code would be:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Key Collection Item&lt;/STRONG&gt; (I keep it since it is count)&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp;A1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp; B1,B2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I am still confused by your "Set Your_data" inside do loop and other steps. Can you show us how observation 1, 2, 3&amp;nbsp;work in detail?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Sep 2018 00:57:44 GMT</pubDate>
    <dc:creator>jsbyxws</dc:creator>
    <dc:date>2018-09-06T00:57:44Z</dc:date>
    <item>
      <title>Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/52826#M14544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good day, everyone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's my sample data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Key.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Data&lt;/P&gt;&lt;P&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 077123&lt;/P&gt;&lt;P&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 098546-&lt;/P&gt;&lt;P&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 875433&lt;/P&gt;&lt;P&gt;Def123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 345423&lt;/P&gt;&lt;P&gt;Def123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 344565x&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to get result as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 077123&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 098546-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 875433&lt;/P&gt;&lt;P&gt;Def123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 345423&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 344565x&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result should only be 2 observations. 1st observation is with key Abc123 . 2nd observation is with key Def123.&lt;/P&gt;&lt;P&gt;Notice the data column has been combined into one variable and displayed below one another....but in a single observstion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i do the above. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 07:53:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/52826#M14544</guid>
      <dc:creator>ZoeyElle</dc:creator>
      <dc:date>2011-08-23T07:53:37Z</dc:date>
    </item>
    <item>
      <title>Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/52827#M14545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Seems like a report requirement to me...?&lt;/P&gt;&lt;P&gt;Take a look at PROC PRINT with BY and ID statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Linus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 12:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/52827#M14545</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2011-08-23T12:02:46Z</dc:date>
    </item>
    <item>
      <title>Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/52828#M14546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data input;&lt;/P&gt;&lt;P&gt; input key $ data $;&lt;/P&gt;&lt;P&gt; cards;&lt;/P&gt;&lt;P&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 077123&lt;/P&gt;&lt;P&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 098546-&lt;/P&gt;&lt;P&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 875433&lt;/P&gt;&lt;P&gt;Def123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 345423&lt;/P&gt;&lt;P&gt;Def123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 344565x&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=input; by key; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Option 1 */&lt;/P&gt;&lt;P&gt;proc print data=input noobs; by key; id key; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Option 2 */&lt;/P&gt;&lt;P&gt;data output;&lt;/P&gt;&lt;P&gt; length all_data $256;&lt;/P&gt;&lt;P&gt; set input;&lt;/P&gt;&lt;P&gt; by key;&lt;/P&gt;&lt;P&gt; retain all_data;&lt;/P&gt;&lt;P&gt; if first.key then all_data=data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; all_data=catx(' ', all_data, data);&lt;/P&gt;&lt;P&gt; if last.key then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=output; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 15:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/52828#M14546</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-08-23T15:09:31Z</dc:date>
    </item>
    <item>
      <title>Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/52829#M14547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May I humbly suggest this is an ill-posed question, not in the SAS way of looking at the problem.&amp;nbsp; The notion that "1 field" spans "3 lines" just doesn't exist in SAS.&amp;nbsp; If it is merely for reporting, then as other posters have suggested, there are multiple ways to have it printed/displayed that way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 18:32:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/52829#M14547</guid>
      <dc:creator>DLing</dc:creator>
      <dc:date>2011-08-23T18:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/52830#M14548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ... here's another idea.&amp;nbsp; Use PROC SUMMARY to aggregate the values within a vakue of KEY, then use a data step to &lt;/P&gt;&lt;P&gt;concatenate the values into one variable.&amp;nbsp; The CLASS variable avoids the sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data input;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;input key $ data $;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;cards;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 077123&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 098546-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 875433&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;Def123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 345423&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;Def123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 344565x&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;proc summary nway data=input missing;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;class key;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;output out=new (drop=_type_ _freq_) idgroup(out[3](data)=);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data new;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;set new;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;newvar = catx(' ', of data:);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;keep key newvar;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are not sure of the number of observations within each key, you can use ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;proc sql noprint;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;select max(obs) into :obs &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;from (select count(*) as obs from input group by key);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;prior to PROC SUMMARY and substitute [&amp;amp;obs] for the [3] used above; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fyi ... "Transposing Data Using PROC SUMMARY'S IDGROUP Option"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.lexjansen.com/pharmasug/2009/tt/tt08.pdf"&gt;http://www.lexjansen.com/pharmasug/2009/tt/tt08.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Aug 2011 03:28:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/52830#M14548</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2011-08-24T03:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/328596#M62507</link>
      <description>&lt;P&gt;data input;&lt;/P&gt;&lt;P&gt;input key $ data $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 077123&lt;/P&gt;&lt;P&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 098546-&lt;/P&gt;&lt;P&gt;Abc123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 875433&lt;/P&gt;&lt;P&gt;Def123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 345423&lt;/P&gt;&lt;P&gt;Def123.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 344565x&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;Proc sort data=input nodupkey out=Input1;&lt;/P&gt;&lt;P&gt;by key;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;this will delet the number of dulicate observation.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 21:59:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/328596#M62507</guid>
      <dc:creator>Irfanmohammed</dc:creator>
      <dc:date>2017-01-30T21:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/328637#M62508</link>
      <description>&lt;P&gt;But it will also lose the data components from the 2nd, 3rd, etc records for each key.&amp;nbsp; The OP wants to keep them.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 03:58:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/328637#M62508</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-01-31T03:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/328638#M62509</link>
      <description>&lt;P&gt;If you don't know the size of the largest group, you could also just put in a number (say 100) that you know is larger than the size of any possible key group.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 04:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/328638#M62509</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-01-31T04:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/329016#M62531</link>
      <description>&lt;P&gt;assuming your data are in KEY order, you could write this short data step&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data out1 ( compress= yes  keep= key collection ) ;
   retain KEY ;
   length collection $10000 ; 
   Do item=1 by 1 until( last.KEY ) ;
      set your_data ;
      by KEY ;
      collection = catX( ',', collection, data ) ;
   End ;   
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;That seems likely to provide what is wanted but without arranging the comma-separated data in COLLECTION into a column&lt;BR /&gt; &lt;BR /&gt;Perhaps the separator (in the catx() function call) should be '0A'x instead of ','.&lt;BR /&gt;Then in excel the collection would / might appear on multiple lines within the cell.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 10:30:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/329016#M62531</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2017-02-01T10:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/329028#M62532</link>
      <description>edited to format code and remove typo(s)</description>
      <pubDate>Wed, 01 Feb 2017 10:31:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/329028#M62532</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2017-02-01T10:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/329112#M62535</link>
      <description>&lt;P&gt;if this the case then you will have to creat a new data set by copying this data set and give an option of first.(variable) then output=(new variable); run;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 15:17:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/329112#M62535</guid>
      <dc:creator>Irfanmohammed</dc:creator>
      <dc:date>2017-02-01T15:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/399907#M66680</link>
      <description>&lt;P&gt;If you want to collapse observations of the same BY value into a single observation, you can use the sample code in this SAS note.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/24/745.html" target="_blank"&gt;http://support.sas.com/kb/24/745.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 19:46:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/399907#M66680</guid>
      <dc:creator>kmw</dc:creator>
      <dc:date>2017-09-29T19:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/492851#M72243</link>
      <description>&lt;P&gt;Hi Peter,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the code! It works and I don't know why. Can you help to explain step by step for your code with following sample data (name &lt;STRONG&gt;have&lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Key Data&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; A1&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp;B1&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp;B2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result based on your code would be:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Key Collection Item&lt;/STRONG&gt; (I keep it since it is count)&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp;A1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp; B1,B2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I am still confused by your "Set Your_data" inside do loop and other steps. Can you show us how observation 1, 2, 3&amp;nbsp;work in detail?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 00:57:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/492851#M72243</guid>
      <dc:creator>jsbyxws</dc:creator>
      <dc:date>2018-09-06T00:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/492914#M72248</link>
      <description>Try the dataset debugger (which now works in EG ).&lt;BR /&gt;It allows you to watch values change, as each statement is executed</description>
      <pubDate>Thu, 06 Sep 2018 08:47:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/492914#M72248</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2018-09-06T08:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Combine multiple observations into one if they have the same Id</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/492916#M72249</link>
      <description>Apple.  for typo.... look for the data step debugger&lt;BR /&gt;There are a number of great articles in the SAS DUMMY blog.&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Sep 2018 08:49:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Combine-multiple-observations-into-one-if-they-have-the-same-Id/m-p/492916#M72249</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2018-09-06T08:49:13Z</dc:date>
    </item>
  </channel>
</rss>

