<?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: create a ascending number conditionally in the last column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-a-ascending-number-conditionally-in-the-last-column/m-p/100538#M21067</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Reeza.&lt;/P&gt;&lt;P&gt;And if you need the kind of output you specified (group processing only, no sorting),&lt;/P&gt;&lt;P&gt;then you may want to add: NOTSORTED and skip pre-sorting altogether.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data t;&lt;/P&gt;&lt;P&gt;set t;&lt;/P&gt;&lt;P&gt;by sec dt NOTSORTED;&lt;/P&gt;&lt;P&gt;if first.dt then n=1;&lt;/P&gt;&lt;P&gt;else n+1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 15 Dec 2012 13:33:33 GMT</pubDate>
    <dc:creator>joehinson</dc:creator>
    <dc:date>2012-12-15T13:33:33Z</dc:date>
    <item>
      <title>create a ascending number conditionally in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-ascending-number-conditionally-in-the-last-column/m-p/100534#M21063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;WANT TO assign _n_ number in ascending order based on sec, dt, rate in the last column.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; t;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; sec dt rate;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1 9205 0.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1 9205 0.3&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1 9205 0.4&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1 9204 0.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1 9204 0.3&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;1 9204 0.4&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;2 9205 0.1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;2 9205 0.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;2 9204 0.1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;2 9204 0.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;3 9205 0.8&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;3 9205 0.9&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;3 9205 1.1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;3 9205 3.5&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;3 9205 4.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;/* &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;WANT TO assign _n_ number in ascending order based on rate in the last column&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;1 9205 0.2 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;1 9205 0.3 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;1 9205 0.4 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;1 9204 0.2 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;1 9204 0.3 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;1 9204 0.4 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;2 9205 0.1 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;2 9205 0.2 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;2 9204 0.1 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;2 9204 0.2 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;3 9205 0.8 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;3 9205 0.9 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;3 9205 1.1 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;3 9205 3.5 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;3 9205 4.2 5&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;*/&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2012 22:38:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-ascending-number-conditionally-in-the-last-column/m-p/100534#M21063</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-12-14T22:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: create a ascending number conditionally in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-ascending-number-conditionally-in-the-last-column/m-p/100535#M21064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set t;&lt;/P&gt;&lt;P&gt;retain count;&lt;/P&gt;&lt;P&gt;prev_value=lag(rate);&lt;/P&gt;&lt;P&gt;if value&amp;lt;prev_value then count=1;&lt;/P&gt;&lt;P&gt;else count+1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2012 22:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-ascending-number-conditionally-in-the-last-column/m-p/100535#M21064</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-12-14T22:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: create a ascending number conditionally in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-ascending-number-conditionally-in-the-last-column/m-p/100536#M21065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;sort&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=t;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; sec dt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; t;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; t;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; sec dt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; first.rate &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; n=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; ; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; n+&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; last.rate &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;stop&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;It doesn't work, I don't know how to reset the n using first. and last. form to assign the n in ascending order.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2012 23:04:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-ascending-number-conditionally-in-the-last-column/m-p/100536#M21065</guid>
      <dc:creator>ZRick</dc:creator>
      <dc:date>2012-12-14T23:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: create a ascending number conditionally in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-ascending-number-conditionally-in-the-last-column/m-p/100537#M21066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Change your first.rate to first.dt&lt;/P&gt;&lt;P&gt;And you don't need the last. and stop line.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2012 23:16:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-ascending-number-conditionally-in-the-last-column/m-p/100537#M21066</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-12-14T23:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: create a ascending number conditionally in the last column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-a-ascending-number-conditionally-in-the-last-column/m-p/100538#M21067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Reeza.&lt;/P&gt;&lt;P&gt;And if you need the kind of output you specified (group processing only, no sorting),&lt;/P&gt;&lt;P&gt;then you may want to add: NOTSORTED and skip pre-sorting altogether.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data t;&lt;/P&gt;&lt;P&gt;set t;&lt;/P&gt;&lt;P&gt;by sec dt NOTSORTED;&lt;/P&gt;&lt;P&gt;if first.dt then n=1;&lt;/P&gt;&lt;P&gt;else n+1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Dec 2012 13:33:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-a-ascending-number-conditionally-in-the-last-column/m-p/100538#M21067</guid>
      <dc:creator>joehinson</dc:creator>
      <dc:date>2012-12-15T13:33:33Z</dc:date>
    </item>
  </channel>
</rss>

