<?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: Multiple Conditional in one colum in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205417#M51150</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please check the query as u have used variable ' last 3m ' in the question and its not there in the output .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Jun 2015 12:18:16 GMT</pubDate>
    <dc:creator>naveen20jan</dc:creator>
    <dc:date>2015-06-15T12:18:16Z</dc:date>
    <item>
      <title>Multiple Conditional in one colum</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205416#M51149</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;&lt;SPAN style="font-size: 14.6666666666667px; font-family: Calibri; color: #000000;"&gt;I had four conditions to be passed on status variable.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.6666666666667px; font-family: Calibri; color: #000000;"&gt;If customer don`t have service 01 then customer should have a status "Other"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.6666666666667px; font-family: Calibri; color: #000000;"&gt;If customer&amp;nbsp; last 6m sales is blank customer should have status "Call BACK"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.6666666666667px; font-family: Calibri; color: #000000;"&gt;If customer dont&amp;nbsp; last 9m sales and in last 6m sales is blank customer should have a status "Gone"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.6666666666667px; font-family: Calibri; color: #000000;"&gt;If&amp;nbsp; customer had sales in the last 6 m and last 9 m then customer should have a status "Active"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to replicate these condition to SAS but at the moment ,I had only the status "others" that work fine and the status "call back" is passed&lt;/P&gt;&lt;P&gt;on to my all customers even though some of them should have a status "gone" or "active".&lt;/P&gt;&lt;P&gt;Below is my attempt to&amp;nbsp; code the conditions :&lt;/P&gt;&lt;P dir="ltr" style="margin-bottom: 10pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 14.6666666666667px; font-family: Calibri; color: #000000;"&gt;if (Service ^= "01") then status = "Others";&lt;/SPAN&gt;&lt;/P&gt;&lt;P dir="ltr" style="margin-bottom: 10pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 14.6666666666667px; font-family: Calibri; color: #000000;"&gt;else if&amp;nbsp; (Service = "01") and&amp;nbsp; ('last 6m sales' &amp;lt;= '0') and ('last 9m sales' &amp;lt;= '0') then Status = "Gone";&lt;/SPAN&gt;&lt;/P&gt;&lt;P dir="ltr" style="margin-bottom: 10pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 14.6666666666667px; font-family: Calibri; color: #000000;"&gt;else if (Service = "01") and ('last 6m sales' &amp;lt;= '0') then Status = "Call Back"; &lt;/SPAN&gt;&lt;/P&gt;&lt;P dir="ltr" style="margin-bottom: 10pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 14.6666666666667px; font-family: Calibri; color: #000000;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P dir="ltr" style="margin-bottom: 10pt; font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 14.6666666666667px; font-family: Calibri; color: #000000;"&gt;Here you can see what the output should be.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="74" style="border: 1px solid #000000; width: 377px; height: 61px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Customer&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Service&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Sales last 6&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;Sales last 9&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Status&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;O1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Call Back&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;O2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Others&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;c&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;O1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Active&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;d&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;O1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;Gone&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;The only thing I can see it that instead to type &amp;lt;=0 as a condition it should be about looking for missing values?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Jun 2015 14:19:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205416#M51149</guid>
      <dc:creator>Jeandas</dc:creator>
      <dc:date>2015-06-13T14:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Conditional in one colum</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205417#M51150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please check the query as u have used variable ' last 3m ' in the question and its not there in the output .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 12:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205417#M51150</guid>
      <dc:creator>naveen20jan</dc:creator>
      <dc:date>2015-06-15T12:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Conditional in one colum</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205418#M51151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming in the output table "Sales last 6" is equal to the variable in your IF Statement 'last 6m sales', you need to have an "n" afterwards so SAS can read your variable with the spaces in it.&amp;nbsp; So, instead of 'last 6m sales'&amp;lt;='0' it should be 'last 6m sales'n&amp;lt;='0'.&amp;nbsp; I would also look into adding a condition for missing values as you mentioned at the end for the Sales last variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Derek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 14:18:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205418#M51151</guid>
      <dc:creator>dcruik</dc:creator>
      <dc:date>2015-06-15T14:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Conditional in one colum</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205419#M51152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Sorry bad typography I edited the post&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Jean&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 15:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205419#M51152</guid>
      <dc:creator>Jeandas</dc:creator>
      <dc:date>2015-06-15T15:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Conditional in one colum</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205420#M51153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the 01 condition zero and one or letter o and 1? Your example data appears to show both Zero and Capital O. If your data is mixing these which is the condition to search for?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 15:24:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205420#M51153</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-06-15T15:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Conditional in one colum</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205421#M51154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;The condition is O1 ,the letter O and 1.&lt;/P&gt;&lt;P&gt;I will edit my example is should be O1&amp;nbsp; not zero and one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 15:46:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205421#M51154</guid>
      <dc:creator>Jeandas</dc:creator>
      <dc:date>2015-06-15T15:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Conditional in one colum</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205422#M51155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try nested IF statements containing DO statements for efficiency:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if it's possible to have last 6m sales blank and last 9m sales not blank, but if you have to have last 6m sales to get last 9m sales, then this should work for you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;If Service^="O1" then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Status="Others"; end;&lt;/P&gt;&lt;P&gt;Else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If "last 6m sales"n^="" AND "last 9m sales"n="" then Status="Call Back";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else if "last 6m sales"n="" AND "last 9m sales"n="" then Status="Gone";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else Status="Active"; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2015 17:17:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Multiple-Conditional-in-one-colum/m-p/205422#M51155</guid>
      <dc:creator>dcruik</dc:creator>
      <dc:date>2015-06-15T17:17:48Z</dc:date>
    </item>
  </channel>
</rss>

