<?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: Combining rows &amp;amp; counting in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combining-rows-amp-counting/m-p/245329#M268544</link>
    <description>&lt;P&gt;Please don't post the same question in multiple boards &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jan 2016 22:13:37 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-01-21T22:13:37Z</dc:date>
    <item>
      <title>Combining rows &amp; counting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-rows-amp-counting/m-p/245308#M268542</link>
      <description>&lt;P&gt;Hi, I'm new to SAS, and apologize if this question has been asked elsewhere.&amp;nbsp; I have been searching previous messages for this type of work and couldn't find what I wanted.&amp;nbsp; I have a dataset that contains multiple rows per patient.&amp;nbsp; I'd like to combine all the rows for each patient, and also create an additional column with a count of how many rows were combined.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, for example, I'm starting with a dataset that looks like this:&lt;/P&gt;&lt;P&gt;&lt;U&gt;patient &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; fruit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; color&lt;/U&gt;&lt;/P&gt;&lt;P&gt;patientA &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; apple&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; red&lt;/P&gt;&lt;P&gt;patientA &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; banana&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; red&lt;/P&gt;&lt;P&gt;patientA &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mango &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; red&lt;/P&gt;&lt;P&gt;patientB &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; apple &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; blue&lt;/P&gt;&lt;P&gt;patientC &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cherry &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; green&lt;/P&gt;&lt;P&gt;patientC &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; grape &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; green.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I want to reorganize into a dataset that looks something like this:&lt;/P&gt;&lt;P&gt;&lt;U&gt;patient &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; count &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; fruit_1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; fruit_2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; fruit_3 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; color&lt;/U&gt;&lt;/P&gt;&lt;P&gt;patientA &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 3 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; apple &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; banana &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mango &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; red&lt;/P&gt;&lt;P&gt;patientB &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 1 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; apple &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (blank) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (blank) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; blue&lt;/P&gt;&lt;P&gt;patientC &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cherry &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; grape &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (blank) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; green.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help.&amp;nbsp; I have been struggling with this for days, trying combinations of different lines I've been piecing together from searches.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 21:39:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-rows-amp-counting/m-p/245308#M268542</guid>
      <dc:creator>beginner</dc:creator>
      <dc:date>2016-01-21T21:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Combining rows &amp; counting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-rows-amp-counting/m-p/245324#M268543</link>
      <description>&lt;P&gt;Here you go:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;input patient$ fruit$ color$;&lt;BR /&gt;cards;&lt;BR /&gt;patientA apple red&lt;BR /&gt;patientA banana red&lt;BR /&gt;patientA mango red&lt;BR /&gt;patientB apple blue&lt;BR /&gt;patientC cherry green&lt;BR /&gt;patientC grape green&lt;BR /&gt;;run;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table count as&lt;BR /&gt;select *,count(patient) as count&lt;BR /&gt;from have&lt;BR /&gt;group by patient&lt;BR /&gt;order by patient,fruit;&lt;/P&gt;
&lt;P&gt;proc transpose data=count out=want(drop=_NAME_) prefix=fruit_;by patient count color;var fruit;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 22:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-rows-amp-counting/m-p/245324#M268543</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2016-01-21T22:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Combining rows &amp; counting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-rows-amp-counting/m-p/245329#M268544</link>
      <description>&lt;P&gt;Please don't post the same question in multiple boards &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 22:13:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-rows-amp-counting/m-p/245329#M268544</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-21T22:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Combining rows &amp; counting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-rows-amp-counting/m-p/245569#M268545</link>
      <description>&lt;P&gt;Oh, I'm sorry.&amp;nbsp; I wasn't sure what category my question fell under, and didn't realize the experts manned multiple boards (though in retrospect that seems obvious).&amp;nbsp; Thank you both for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 22:59:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-rows-amp-counting/m-p/245569#M268545</guid>
      <dc:creator>beginner</dc:creator>
      <dc:date>2016-01-22T22:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Combining rows &amp; counting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-rows-amp-counting/m-p/245574#M268546</link>
      <description>&lt;P&gt;One reason we request not posting in multiple areas is that&amp;nbsp;questions about requirements and the responsed are likely to get separated across the threads and we may be working on incomplete knowledge of requirements. Also when a proposed solution is posted and you respond with a previously forgotten or missed requirement that will only be one one thread, not multiples.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 23:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-rows-amp-counting/m-p/245574#M268546</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-01-22T23:48:45Z</dc:date>
    </item>
  </channel>
</rss>

