<?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 How to combine rows of data in SAS in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-combine-rows-of-data-in-SAS/m-p/389449#M66049</link>
    <description>&lt;P&gt;I am trying to combine/collapse data to make it easier to run statistics on, but am having trouble on how to combine the data.&lt;/P&gt;&lt;P&gt;I was given billing data, and therefore patients can be billed multiple times for the same procedure using different billing codes.&lt;/P&gt;&lt;P&gt;I am trying to combine rows of data into a single row based on a patient's MRN and their date of surgery regardless of their billing codes (as I have recoded all the billing codes into bundles based on the procedure type).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MRN &amp;nbsp; &amp;nbsp; &amp;nbsp;DOB &amp;nbsp; &amp;nbsp; &amp;nbsp; Date of Surgery &amp;nbsp; &amp;nbsp;Procedure Code&lt;/P&gt;&lt;P&gt;12345 &amp;nbsp; &amp;nbsp;1/1/11 &amp;nbsp; &amp;nbsp;July 1, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12345&lt;/P&gt;&lt;P&gt;12345 &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;1/1/11 &amp;nbsp; &amp;nbsp;July 1, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12345&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;67890 &amp;nbsp; &amp;nbsp;2/2/22 &amp;nbsp; &amp;nbsp;July 2, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12345&lt;/P&gt;&lt;P&gt;67890 &amp;nbsp; 2/2/22 &amp;nbsp; &amp;nbsp; July 3, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 23456&lt;/P&gt;&lt;P&gt;45678 &amp;nbsp; 3/3/33 &amp;nbsp; &amp;nbsp; July 4, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 567890&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;45678 &amp;nbsp; 3/3/33 &amp;nbsp; &amp;nbsp; July 4, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 567890&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;45678 &amp;nbsp; 3/3/33 &amp;nbsp; &amp;nbsp; July 4, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 567890&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the above example, I woul want it to be collapsed to the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;MRN &amp;nbsp; &amp;nbsp; &amp;nbsp;DOB &amp;nbsp; &amp;nbsp; &amp;nbsp; Date of Surgery &amp;nbsp; &amp;nbsp;Procedure Code&lt;/P&gt;&lt;P&gt;12345 &amp;nbsp; &amp;nbsp;1/1/11 &amp;nbsp; &amp;nbsp;July 1, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12345&lt;/P&gt;&lt;P&gt;67890 &amp;nbsp; &amp;nbsp;2/2/22 &amp;nbsp; &amp;nbsp;July 2, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12345&lt;/P&gt;&lt;P&gt;67890 &amp;nbsp; 2/2/22 &amp;nbsp; &amp;nbsp; July 3, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 23456&lt;/P&gt;&lt;P&gt;45678 &amp;nbsp; 3/3/33 &amp;nbsp; &amp;nbsp; July 4, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 567890&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;PROC MEANS NWAY;
  CLASS ;
  VAR ;
  OUTPUT OUT= MEAN= STD= N=;
RUN;&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;But this did not work out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Mon, 21 Aug 2017 04:57:20 GMT</pubDate>
    <dc:creator>adamtanious</dc:creator>
    <dc:date>2017-08-21T04:57:20Z</dc:date>
    <item>
      <title>How to combine rows of data in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-combine-rows-of-data-in-SAS/m-p/389449#M66049</link>
      <description>&lt;P&gt;I am trying to combine/collapse data to make it easier to run statistics on, but am having trouble on how to combine the data.&lt;/P&gt;&lt;P&gt;I was given billing data, and therefore patients can be billed multiple times for the same procedure using different billing codes.&lt;/P&gt;&lt;P&gt;I am trying to combine rows of data into a single row based on a patient's MRN and their date of surgery regardless of their billing codes (as I have recoded all the billing codes into bundles based on the procedure type).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i.e.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MRN &amp;nbsp; &amp;nbsp; &amp;nbsp;DOB &amp;nbsp; &amp;nbsp; &amp;nbsp; Date of Surgery &amp;nbsp; &amp;nbsp;Procedure Code&lt;/P&gt;&lt;P&gt;12345 &amp;nbsp; &amp;nbsp;1/1/11 &amp;nbsp; &amp;nbsp;July 1, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12345&lt;/P&gt;&lt;P&gt;12345 &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;1/1/11 &amp;nbsp; &amp;nbsp;July 1, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12345&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;67890 &amp;nbsp; &amp;nbsp;2/2/22 &amp;nbsp; &amp;nbsp;July 2, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12345&lt;/P&gt;&lt;P&gt;67890 &amp;nbsp; 2/2/22 &amp;nbsp; &amp;nbsp; July 3, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 23456&lt;/P&gt;&lt;P&gt;45678 &amp;nbsp; 3/3/33 &amp;nbsp; &amp;nbsp; July 4, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 567890&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;45678 &amp;nbsp; 3/3/33 &amp;nbsp; &amp;nbsp; July 4, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 567890&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;45678 &amp;nbsp; 3/3/33 &amp;nbsp; &amp;nbsp; July 4, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 567890&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the above example, I woul want it to be collapsed to the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;MRN &amp;nbsp; &amp;nbsp; &amp;nbsp;DOB &amp;nbsp; &amp;nbsp; &amp;nbsp; Date of Surgery &amp;nbsp; &amp;nbsp;Procedure Code&lt;/P&gt;&lt;P&gt;12345 &amp;nbsp; &amp;nbsp;1/1/11 &amp;nbsp; &amp;nbsp;July 1, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12345&lt;/P&gt;&lt;P&gt;67890 &amp;nbsp; &amp;nbsp;2/2/22 &amp;nbsp; &amp;nbsp;July 2, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12345&lt;/P&gt;&lt;P&gt;67890 &amp;nbsp; 2/2/22 &amp;nbsp; &amp;nbsp; July 3, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 23456&lt;/P&gt;&lt;P&gt;45678 &amp;nbsp; 3/3/33 &amp;nbsp; &amp;nbsp; July 4, 2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 567890&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;PROC MEANS NWAY;
  CLASS ;
  VAR ;
  OUTPUT OUT= MEAN= STD= N=;
RUN;&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;But this did not work out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2017 04:57:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-combine-rows-of-data-in-SAS/m-p/389449#M66049</guid>
      <dc:creator>adamtanious</dc:creator>
      <dc:date>2017-08-21T04:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine rows of data in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-combine-rows-of-data-in-SAS/m-p/389455#M66050</link>
      <description>&lt;P&gt;Is that the PROC MEANS code you submitted? If not, please post the exact code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at PROC SORT with the NODUPKEY option.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2017 05:53:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-combine-rows-of-data-in-SAS/m-p/389455#M66050</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-21T05:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine rows of data in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-combine-rows-of-data-in-SAS/m-p/389476#M66051</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TRY THIS CODE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=have out=want nodup;by&amp;nbsp;&lt;SPAN&gt;MRN;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2017 09:56:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-combine-rows-of-data-in-SAS/m-p/389476#M66051</guid>
      <dc:creator>TarunKumar</dc:creator>
      <dc:date>2017-08-21T09:56:19Z</dc:date>
    </item>
  </channel>
</rss>

