<?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 can i get the final dataset ? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-can-i-get-the-final-dataset/m-p/109912#M30538</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have time to optimize the following code, but it appears to produce your wanted result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat subid $3.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat soc $30.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat pft $30.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input subid trt SOC &amp;amp; PFT &amp;amp;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;021 2 Gastrointestinal disorders Constipation&lt;/P&gt;&lt;P&gt;031 1 Gastrointestinal disorders Hypoaesthesia oral&lt;/P&gt;&lt;P&gt;065 1 Gastrointestinal disorders Paraesthesia oral&lt;/P&gt;&lt;P&gt;103 2 Gastrointestinal disorders Abdominal pain upper&lt;/P&gt;&lt;P&gt;020 2 Eye disorders Conjunctivitis&lt;/P&gt;&lt;P&gt;087 1 Eye disorders Ocular hyperaemia&lt;/P&gt;&lt;P&gt;087 1 Eye disorders Eye swelling&lt;/P&gt;&lt;P&gt;088 1 Eye disorders Eye swelling&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (keep=variable _: total hlt_indx type);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by soc pft notsorted;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain _1 _2 grand_total grand_1 grand_2 type;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.soc then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; type='lit';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grand_total=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grand_1=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grand_2=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hlt_indx+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.pft then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _1=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _2=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _1=ifn(trt=1,sum(_1,10),sum(_1,0));&lt;/P&gt;&lt;P&gt;&amp;nbsp; _2=ifn(trt=2,sum(_2,10),sum(_2,0));&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last.pft then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; total=sum(_1,_2)/2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grand_total=sum(grand_total,total);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grand_1=sum(grand_1,_1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grand_2=sum(grand_2,_2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable=pft;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last.soc then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; type='hlt';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; total=grand_total;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _1=grand_1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _2=grand_2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable=soc;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by hlt_indx type;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain variable _1 _2 Total hlt_indx type;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set want;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Dec 2012 15:33:29 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2012-12-28T15:33:29Z</dc:date>
    <item>
      <title>How can i get the final dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-i-get-the-final-dataset/m-p/109911#M30537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please help in this regard.&lt;/P&gt;&lt;P&gt;In a clinical trial two treatments with 1(n=10) and 2(n=10) with a total of 20 subjects.&lt;/P&gt;&lt;P&gt;Suppose the indput AE dataset is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 302px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" width="64"&gt;subid&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;trt&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;SOC&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="110"&gt;PFT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;021&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Gastrointestinal disorders&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Constipation&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;031&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Gastrointestinal disorders&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Hypoaesthesia oral&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;065&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Gastrointestinal disorders&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Paraesthesia oral&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;103&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Gastrointestinal disorders&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Abdominal pain upper&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;020&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Eye disorders&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Conjunctivitis&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;087&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Eye disorders&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Ocular hyperaemia&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;087&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Eye disorders&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Eye swelling&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;088&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Eye disorders&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Eye swelling&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Final dataset should be like this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 430px;"&gt;&lt;TBODY&gt;&lt;/TBODY&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" width="64"&gt;Variable&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-left: none;" width="110"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-left: none;" width="64"&gt;2&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;Total&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt; hlt_indx&lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt; &lt;/TD&gt;&lt;TD class="xl66" style="border-left: none;" width="64"&gt;type&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;Gastrointestinal disorders&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;20&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;20&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;20&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;hlt&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;Constipation&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;llt&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;Hypoaesthesia oral&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;llt&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;Paraesthesia oral&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;llt&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;Abdominal pain upper&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;llt&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;Eye disorders&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;30&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;20&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;hlt&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;Conjunctivitis&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;llt&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;Ocular hyperaemia&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;llt&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20" style="border-top: none;"&gt;Eye swelling&lt;/TD&gt;&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;20&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;0&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;10&lt;/TD&gt;&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt; &lt;/TD&gt;&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;llt&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Thank you very much in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2012 12:48:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-i-get-the-final-dataset/m-p/109911#M30537</guid>
      <dc:creator>devarayalu</dc:creator>
      <dc:date>2012-12-28T12:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get the final dataset ?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-i-get-the-final-dataset/m-p/109912#M30538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have time to optimize the following code, but it appears to produce your wanted result:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat subid $3.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat soc $30.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat pft $30.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input subid trt SOC &amp;amp; PFT &amp;amp;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;021 2 Gastrointestinal disorders Constipation&lt;/P&gt;&lt;P&gt;031 1 Gastrointestinal disorders Hypoaesthesia oral&lt;/P&gt;&lt;P&gt;065 1 Gastrointestinal disorders Paraesthesia oral&lt;/P&gt;&lt;P&gt;103 2 Gastrointestinal disorders Abdominal pain upper&lt;/P&gt;&lt;P&gt;020 2 Eye disorders Conjunctivitis&lt;/P&gt;&lt;P&gt;087 1 Eye disorders Ocular hyperaemia&lt;/P&gt;&lt;P&gt;087 1 Eye disorders Eye swelling&lt;/P&gt;&lt;P&gt;088 1 Eye disorders Eye swelling&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (keep=variable _: total hlt_indx type);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by soc pft notsorted;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain _1 _2 grand_total grand_1 grand_2 type;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.soc then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; type='lit';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grand_total=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grand_1=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grand_2=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hlt_indx+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.pft then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _1=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _2=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _1=ifn(trt=1,sum(_1,10),sum(_1,0));&lt;/P&gt;&lt;P&gt;&amp;nbsp; _2=ifn(trt=2,sum(_2,10),sum(_2,0));&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last.pft then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; total=sum(_1,_2)/2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grand_total=sum(grand_total,total);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grand_1=sum(grand_1,_1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grand_2=sum(grand_2,_2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable=pft;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last.soc then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; type='hlt';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; total=grand_total;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _1=grand_1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _2=grand_2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; variable=soc;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by hlt_indx type;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain variable _1 _2 Total hlt_indx type;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set want;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2012 15:33:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-i-get-the-final-dataset/m-p/109912#M30538</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-12-28T15:33:29Z</dc:date>
    </item>
  </channel>
</rss>

