<?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: first. and last. statements in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103257#M258308</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DN: I agree with using groupformat (which, I admit, I didn't know about), but I still think that the OP wants to sort by &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;bankname descending brnum&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simply using the groupformat could cause problems if the wrong cases happen to be located somewhere in the middle of that combination.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Oct 2013 22:59:36 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2013-10-03T22:59:36Z</dc:date>
    <item>
      <title>first. and last. statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103254#M258305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;input bankname brnum cntyname&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;Bofa 0 Mecklenburg&lt;/P&gt;&lt;P&gt;Bofa 1 Orange&lt;/P&gt;&lt;P&gt;Bofa 2 Ventura&lt;/P&gt;&lt;P&gt;Bofa 3 Amameda&lt;/P&gt;&lt;P&gt;Welch 0 Contra Costa&lt;/P&gt;&lt;P&gt;Welch 1 Los Angeles&lt;/P&gt;&lt;P&gt;Wlech 3 Tulare&lt;/P&gt;&lt;P&gt;Chase 0 Kern&lt;/P&gt;&lt;P&gt;Chase 1 Shasta&lt;/P&gt;&lt;P&gt;Chase 2 Santa Cruz&lt;/P&gt;&lt;P&gt;chase 3 Yolo&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data new;&lt;/P&gt;&lt;P&gt;set temp;&lt;/P&gt;&lt;P&gt;retain totbr;&lt;/P&gt;&lt;P&gt;attrib totbr informat=8. format 12.&lt;/P&gt;&lt;P&gt;by bankname;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if first.bankname then do;&lt;/P&gt;&lt;P&gt;totbr = 0;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;if last.bankname then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I would like to have the brnum '0' information on the dataset than having the last record info.&lt;/P&gt;&lt;P&gt;I want to use first. and last. statements calculate the totbr, otherwise I want to have the first record of bankname(brnum=0) info onthe new dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would any one help on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 20:05:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103254#M258305</guid>
      <dc:creator>saslovethemost</dc:creator>
      <dc:date>2013-10-03T20:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: first. and last. statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103255#M258306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm surprised that no one has responded.&amp;nbsp; If your data really have mixed case (e.g., chase and Chase), you should pre-process the data to convert bankname to uppercase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, to do what you want, sort by bankname descending brnum, then use the code you indicated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 21:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103255#M258306</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-10-03T21:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: first. and last. statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103256#M258307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;GROUPFORMAT?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; temp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; bankname $ brnum cntyname &amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$30.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;cards&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffc0;"&gt;Bofa 0 Mecklenburg&lt;BR /&gt;bofa 1 Orange&lt;BR /&gt;Bofa 2 Ventura&lt;BR /&gt;Bofa 3 Amameda&lt;BR /&gt;welch 0 Contra Costa&lt;BR /&gt;Welch 1 Los Angeles&lt;BR /&gt;WelCh 3 Tulare&lt;BR /&gt;ChaSe 0 Kern&lt;BR /&gt;Chase 1 Shasta&lt;BR /&gt;Chase 2 Santa Cruz&lt;BR /&gt;chase 3 Yolo&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;;;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; new;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; temp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; bankname &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;$upcase.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; bankname &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;groupformat&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;notsorted&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;retain&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; totbr;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; first.bankname &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;do&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; totbr = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;0&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;end&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; last.bankname &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;output&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;print&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;run&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 21:56:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103256#M258307</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2013-10-03T21:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: first. and last. statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103257#M258308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DN: I agree with using groupformat (which, I admit, I didn't know about), but I still think that the OP wants to sort by &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;bankname descending brnum&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simply using the groupformat could cause problems if the wrong cases happen to be located somewhere in the middle of that combination.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 22:59:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103257#M258308</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-10-03T22:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: first. and last. statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103258#M258309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think saslovethemost wrote that as an example and forgot the specifics. Anyways, a quick and dirty approach would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort the data first by bankname and then by descending brname and use the same code as you are using currently&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data = temp;&lt;/P&gt;&lt;P&gt;by bankname descending brname ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;and your first. and last. calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Somi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 23:10:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103258#M258309</guid>
      <dc:creator>hsharmas</dc:creator>
      <dc:date>2013-10-03T23:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: first. and last. statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103259#M258310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ohh I am sorry Arthur already indicated that approach!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 23:12:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/first-and-last-statements/m-p/103259#M258310</guid>
      <dc:creator>hsharmas</dc:creator>
      <dc:date>2013-10-03T23:12:24Z</dc:date>
    </item>
  </channel>
</rss>

