<?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 Conditional processing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Conditional-processing/m-p/832918#M329252</link>
    <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;I have 2 columns with ratings A-K. One column is "incoming" rating (IB) of a period and the other "outgoing" (OB).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to create a new column based on several conditions:&lt;/P&gt;&lt;P&gt;0 if no change during the period&lt;/P&gt;&lt;P&gt;1 if moved up 1 class, 2 if moved up 2 classes etc&lt;/P&gt;&lt;P&gt;-1 if moved down 1 class, 2 if moved down 2 classes etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would one go about accomplishing this without creating one hundred case when lines?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Sep 2022 15:14:42 GMT</pubDate>
    <dc:creator>alpod87</dc:creator>
    <dc:date>2022-09-12T15:14:42Z</dc:date>
    <item>
      <title>Conditional processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-processing/m-p/832918#M329252</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&lt;BR /&gt;I have 2 columns with ratings A-K. One column is "incoming" rating (IB) of a period and the other "outgoing" (OB).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to create a new column based on several conditions:&lt;/P&gt;&lt;P&gt;0 if no change during the period&lt;/P&gt;&lt;P&gt;1 if moved up 1 class, 2 if moved up 2 classes etc&lt;/P&gt;&lt;P&gt;-1 if moved down 1 class, 2 if moved down 2 classes etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would one go about accomplishing this without creating one hundred case when lines?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 15:14:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-processing/m-p/832918#M329252</guid>
      <dc:creator>alpod87</dc:creator>
      <dc:date>2022-09-12T15:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-processing/m-p/832920#M329254</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I'm looking to create a new column based on several conditions:&lt;/P&gt;
&lt;P&gt;0 if no change during the period&lt;/P&gt;
&lt;P&gt;1 if moved up 1 class, 2 if moved up 2 classes etc&lt;/P&gt;
&lt;P&gt;-1 if moved down 1 class, 2 if moved down 2 classes etc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How would one go about accomplishing this without creating one hundred case when lines?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create new variables where the letters A, B, ... K are replaced by numbers and then the moving up or moving down is computed by subtraction. You can use the RANK function to obtain the numerical equivalent of A, B, ... K in the ASCII collating sequence; that's all you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    ib_rank=rank(ib);
    ob_rank=rank(ob);
    change=ob_rank-ib_rank;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 15:25:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-processing/m-p/832920#M329254</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-09-12T15:25:52Z</dc:date>
    </item>
  </channel>
</rss>

