<?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 Compare two columns first alphabetically? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Compare-two-columns-first-alphabetically/m-p/237473#M55358</link>
    <description>&lt;P&gt;How can I compare two columns to get which one is first alphabetically? I want to put which is first in a 3rd column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;Column1 = Kelly&lt;/P&gt;
&lt;P&gt;Column2 = Katie&lt;/P&gt;
&lt;P&gt;Column3 would be Katie because it is first alphabetically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dataset = Rentals&lt;/P&gt;</description>
    <pubDate>Wed, 02 Dec 2015 21:38:20 GMT</pubDate>
    <dc:creator>Mattress58</dc:creator>
    <dc:date>2015-12-02T21:38:20Z</dc:date>
    <item>
      <title>Compare two columns first alphabetically?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-two-columns-first-alphabetically/m-p/237473#M55358</link>
      <description>&lt;P&gt;How can I compare two columns to get which one is first alphabetically? I want to put which is first in a 3rd column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;Column1 = Kelly&lt;/P&gt;
&lt;P&gt;Column2 = Katie&lt;/P&gt;
&lt;P&gt;Column3 would be Katie because it is first alphabetically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dataset = Rentals&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2015 21:38:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-two-columns-first-alphabetically/m-p/237473#M55358</guid>
      <dc:creator>Mattress58</dc:creator>
      <dc:date>2015-12-02T21:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two columns first alphabetically?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-two-columns-first-alphabetically/m-p/237615#M55372</link>
      <description>&lt;P&gt;Case of letters is an issue as in this example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.example;
   informat column1 column2 $10.;
   input column1 column2;
   if column1 &amp;lt; column2 then column3 = column1;
   else column3 = column2;
datalines;
Kelly Katie
kelly Katie
Kelly katie
kelly katie
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If case should not be considered then you can use either UPCASE(column1) and UPCASE(column2) or LOWCASE in the comparison.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Dec 2015 16:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-two-columns-first-alphabetically/m-p/237615#M55372</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-12-03T16:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two columns first alphabetically?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Compare-two-columns-first-alphabetically/m-p/237685#M55375</link>
      <description>&lt;P&gt;Borrowing from&amp;nbsp;ballardw's example, you can also use "&lt;STRONG&gt;&amp;gt;&amp;lt;&lt;/STRONG&gt;" (min) and "&lt;STRONG&gt;&amp;lt;&amp;gt;&lt;/STRONG&gt;" (max). It works differently than the &lt;STRONG&gt;min()&lt;/STRONG&gt; and &lt;STRONG&gt;max()&lt;/STRONG&gt; functions, which only support numeric variables.&amp;nbsp;&lt;img id="robothappy" class="emoticon emoticon-robothappy" src="https://communities.sas.com/i/smilies/16x16_robot-happy.png" alt="Robot Happy" title="Robot Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.example;
   informat column1 column2 $10.;
   input column1 column2;
   min_of_col1_col2 = (column1 &amp;gt;&amp;lt; column2);
   max_of_col1_col2 = (column1 &amp;lt;&amp;gt; column2);
datalines;
Kelly Katie
kelly Katie
Kelly katie
kelly katie
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Dec 2015 20:03:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Compare-two-columns-first-alphabetically/m-p/237685#M55375</guid>
      <dc:creator>hbi</dc:creator>
      <dc:date>2015-12-03T20:03:07Z</dc:date>
    </item>
  </channel>
</rss>

