<?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: Re arranging the data using code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720515#M223200</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If col1 -- p2 are numeric, use PROC SUMMARY:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have;
class pid;
var col1 col2 p1 p2;
output out=want (drop=_:) max()=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Which is exactly why I was asking about any of the variables having multiple values and the needed results.&lt;/P&gt;
&lt;P&gt;Might actual want a sum or mean or ???&lt;/P&gt;</description>
    <pubDate>Fri, 19 Feb 2021 16:57:59 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-02-19T16:57:59Z</dc:date>
    <item>
      <title>Re arranging the data using code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720474#M223194</link>
      <description>&lt;P&gt;Have this..&lt;/P&gt;
&lt;TABLE width="326"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="81"&gt;PID&lt;/TD&gt;
&lt;TD width="61"&gt;Col1&lt;/TD&gt;
&lt;TD width="60"&gt;Col2&lt;/TD&gt;
&lt;TD width="65"&gt;p1&lt;/TD&gt;
&lt;TD width="59"&gt;p2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt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&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;35&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3923&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Want this..&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 240pt;" border="0" width="320" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="64" height="19" class="xl66" style="height: 14.5pt; width: 48pt;"&gt;PID&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;Col1&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;Col2&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;p1&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;p2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" align="right" class="xl67" style="height: 14.5pt; border-top: none;"&gt;3527&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;21&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;99&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" align="right" class="xl67" style="height: 14.5pt; border-top: none;"&gt;3528&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;25.32&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" align="right" class="xl67" style="height: 14.5pt; border-top: none;"&gt;3400&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;26&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" align="right" class="xl67" style="height: 14.5pt; border-top: none;"&gt;3200&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;33&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;12&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;30.2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" align="right" class="xl67" style="height: 14.5pt; border-top: none;"&gt;3201&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;27&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" align="right" class="xl67" style="height: 14.5pt; border-top: none;"&gt;3923&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;23&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;99&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" align="right" class="xl67" style="height: 14.5pt; border-top: none;"&gt;3922&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;19&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD align="right" class="xl67" style="border-top: none; border-left: none;"&gt;35&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Fri, 19 Feb 2021 14:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720474#M223194</guid>
      <dc:creator>Stalk</dc:creator>
      <dc:date>2021-02-19T14:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Re arranging the data using code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720483#M223195</link>
      <description>&lt;P&gt;By far, the easiest way to achieve this is first to sort your data:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have;
   by pid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then roll up the observations:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   update have (obs=0) have;
   by pid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If for some reason you don't want to sort your data, there are still ways to do it but they become more complex.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 15:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720483#M223195</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-02-19T15:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Re arranging the data using code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720488#M223197</link>
      <description>&lt;P&gt;Rules may help.&lt;/P&gt;
&lt;P&gt;Such what happens if you have two values for any of the Col1, Col2, P1 or P2 variables within a PID value?&lt;/P&gt;
&lt;P&gt;And are those variables numeric or character?&lt;/P&gt;
&lt;P&gt;Are you looking for a data set or a report (people read these)?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 15:31:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720488#M223197</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-19T15:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Re arranging the data using code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720501#M223199</link>
      <description>&lt;P&gt;If col1 -- p2 are numeric, use PROC SUMMARY:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have;
class pid;
var col1 col2 p1 p2;
output out=want (drop=_:) max()=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Feb 2021 16:15:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720501#M223199</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-19T16:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Re arranging the data using code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720515#M223200</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If col1 -- p2 are numeric, use PROC SUMMARY:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have;
class pid;
var col1 col2 p1 p2;
output out=want (drop=_:) max()=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Which is exactly why I was asking about any of the variables having multiple values and the needed results.&lt;/P&gt;
&lt;P&gt;Might actual want a sum or mean or ???&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 16:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720515#M223200</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-19T16:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Re arranging the data using code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720591#M223220</link>
      <description>Looks like this solution worked but still have to test it. Can you explain what exactly this update is doing?&lt;BR /&gt;For other I have both numeric and char fields so proc Summary might not be option .&lt;BR /&gt;Thank you all for your assistance.</description>
      <pubDate>Fri, 19 Feb 2021 22:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720591#M223220</guid>
      <dc:creator>Stalk</dc:creator>
      <dc:date>2021-02-19T22:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Re arranging the data using code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720607#M223224</link>
      <description>&lt;P&gt;UPDATE processes each PID separately.&amp;nbsp; It takes the observations for that PID one at a time, and uses any non-missing values it finds to replace what was there before.&amp;nbsp; So it ignores missing values.&amp;nbsp; When all the observations for a PID have been processed, it outputs the result ... one observation per PID.&lt;/P&gt;</description>
      <pubDate>Sat, 20 Feb 2021 00:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-arranging-the-data-using-code/m-p/720607#M223224</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-02-20T00:32:35Z</dc:date>
    </item>
  </channel>
</rss>

