<?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: PROC FORMAT for ordinal in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185029#M47028</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can always make your own. Does your data have a specific range or is any number possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jun 2014 15:09:25 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-06-04T15:09:25Z</dc:date>
    <item>
      <title>PROC FORMAT for ordinal</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185028#M47027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this may be a very simple question but I have not found an answer yet. Is there a format that can put cardinal numbers into ordinals? Turning, e.g., 1 to 1st, 2 to 2nd, etc? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 15:00:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185028#M47027</guid>
      <dc:creator>ffurquim</dc:creator>
      <dc:date>2014-06-04T15:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT for ordinal</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185029#M47028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can always make your own. Does your data have a specific range or is any number possible?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 15:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185029#M47028</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-04T15:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT for ordinal</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185030#M47029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza...I was hoping to avoid creating my own due to the large range and the fact that the range could grow over time, so a SAS delivered one was preferable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, the range is currently 1 (1st) to 127 (127th), although most values of interest cap out at around 22.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 15:13:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185030#M47029</guid>
      <dc:creator>ffurquim</dc:creator>
      <dc:date>2014-06-04T15:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT for ordinal</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185031#M47030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not that bad, this is borrowed from a 2006 post from David Cassell and &lt;A __default_attr="149594" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data ordinal_format;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; length label $8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do number=1 to 300;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; numstring = put(number, 16. -l);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if prxmatch('/(?&amp;lt;!1)1\s*$/',numstring) then ending='st';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if prxmatch('/(?&amp;lt;!1)2\s*$/',numstring) then ending='nd';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if prxmatch('/(?&amp;lt;!1)3\s*$/',numstring) then ending='rd';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else ending = 'th';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ordstring =catt(numstring, ending);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; start=number;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; label=ordstring;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fmtname="ordinal_fmt";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type="N";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; keep start label fmtname type;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format cntlin=ordinal_format;&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;do i =1 to 100;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; j=i;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;format j ordinal_fmt.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 15:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185031#M47030</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-04T15:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT for ordinal</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185032#M47031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ha, I usually avoid &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;prxmatch&lt;/SPAN&gt; like the plague but here it is, good answer!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 15:23:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185032#M47031</guid>
      <dc:creator>ffurquim</dc:creator>
      <dc:date>2014-06-04T15:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT for ordinal</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185033#M47032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So do I, ergo the "borrowed code" :smileygrin:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2014 15:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-for-ordinal/m-p/185033#M47032</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-04T15:25:14Z</dc:date>
    </item>
  </channel>
</rss>

