<?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: Rearranging data and then do proc report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rearranging-data-and-then-do-proc-report/m-p/293509#M61097</link>
    <description>&lt;P&gt;The good news:&amp;nbsp; it's easy to get the data values that you illustrated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The bad news:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;If you do change the data, there is no guarantee that PROC REPORT will work properly.&amp;nbsp; You will have to try it and see.&lt;/LI&gt;
&lt;LI&gt;You haven't illustrated what should happen to KEY1, when there is a new value for KEY2.&amp;nbsp; So I will guess at that part.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=have;&lt;/P&gt;
&lt;P&gt;by key1 key2 desc;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;by key1 key2;&lt;/P&gt;
&lt;P&gt;if first.key1=0 then key1=.;&lt;/P&gt;
&lt;P&gt;if first.key2=0 then key2=' ';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Start there, and see if it solves all the issues.&amp;nbsp; It might.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Aug 2016 17:55:34 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-08-23T17:55:34Z</dc:date>
    <item>
      <title>Rearranging data and then do proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rearranging-data-and-then-do-proc-report/m-p/293494#M61087</link>
      <description>I have below dataset and need to arrange the first observation by group which I want to use in proc report in next step .. But somehow with First. I am unable to get Desiree output. Can somebody help me here&lt;BR /&gt;&lt;BR /&gt;Dataset Have :&lt;BR /&gt;&lt;BR /&gt;Key1 desc key2&lt;BR /&gt;1 Akshay Nagpur&lt;BR /&gt;1 Rahul Nagpur&lt;BR /&gt;1 Rajesh Nagpur&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Desired Want Dataset as&lt;BR /&gt;&lt;BR /&gt;Key1 Desc Key2&lt;BR /&gt;1 Akshay Nagpur&lt;BR /&gt;. Rahul&lt;BR /&gt;. Rajesh&lt;BR /&gt;&lt;BR /&gt;Any help is really appreciated</description>
      <pubDate>Tue, 23 Aug 2016 17:16:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rearranging-data-and-then-do-proc-report/m-p/293494#M61087</guid>
      <dc:creator>yashpande</dc:creator>
      <dc:date>2016-08-23T17:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Rearranging data and then do proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rearranging-data-and-then-do-proc-report/m-p/293509#M61097</link>
      <description>&lt;P&gt;The good news:&amp;nbsp; it's easy to get the data values that you illustrated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The bad news:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;If you do change the data, there is no guarantee that PROC REPORT will work properly.&amp;nbsp; You will have to try it and see.&lt;/LI&gt;
&lt;LI&gt;You haven't illustrated what should happen to KEY1, when there is a new value for KEY2.&amp;nbsp; So I will guess at that part.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=have;&lt;/P&gt;
&lt;P&gt;by key1 key2 desc;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;by key1 key2;&lt;/P&gt;
&lt;P&gt;if first.key1=0 then key1=.;&lt;/P&gt;
&lt;P&gt;if first.key2=0 then key2=' ';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Start there, and see if it solves all the issues.&amp;nbsp; It might.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 17:55:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rearranging-data-and-then-do-proc-report/m-p/293509#M61097</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-08-23T17:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Rearranging data and then do proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rearranging-data-and-then-do-proc-report/m-p/293601#M61145</link>
      <description>&lt;PRE&gt;
As long as you apply ORDER option on KEY1 KEY2, you gonna get the result you want.


data have;
input Key1 desc $ key2 $;
cards;
1 Akshay Nagpur
1 Rahul Nagpur
1 Rajesh Nagpur
;
run;
proc report data=have nowd;
columns KEY1 desc KEY2;
define KEY1/order;
define KEY2/order;
run;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Aug 2016 02:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rearranging-data-and-then-do-proc-report/m-p/293601#M61145</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-24T02:29:09Z</dc:date>
    </item>
  </channel>
</rss>

