<?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: IF THEN ELSE Help in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/504910#M1054</link>
    <description>&lt;P&gt;see if this correction helps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data work.ifthen;
set work.pelicanstores;
if Net_Sales &amp;lt; 50 THEN Sales = "0-$50";
ELSE IF Net_Sales &amp;gt; 51 AND Net_Sales&amp;lt; 100 then  Sales = "$51-$100";
ELSE IF Net_Sales &amp;gt; 100 AND Net_Sales&amp;lt;200 then Sales = "$101-$200";
ELSE IF Net_Sales &amp;gt; 200 then  Sales ="$200+";

Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.ifthen;
set work.pelicanstores;
if Net_Sales &amp;lt; 50 THEN Sales = "0-$50";
ELSE IF   51&amp;lt;  Net_Sales&amp;lt; 100 then  Sales = "$51-$100";
ELSE IF  100&amp;lt;  Net_Sales&amp;lt;200 then Sales = "$101-$200";
ELSE IF Net_Sales &amp;gt; 200 then  Sales ="$200+";

Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Oct 2018 21:31:40 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-10-16T21:31:40Z</dc:date>
    <item>
      <title>IF THEN ELSE Help</title>
      <link>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/504908#M1052</link>
      <description>&lt;PRE&gt;data work.ifthen;
set work.pelicanstores;
if Net_Sales &amp;lt; 50 THEN Sales = "0-$50";
ELSE IF Net_Sales &amp;gt; 51 AND &amp;lt; 100 Sales = "$51-$100";
ELSE IF Net_Sales &amp;gt; 100 AND &amp;lt;200 Sales = "$101-$200";
ELSE IF Net_Sales &amp;gt; 200 Sales ="$200+";

Run;&lt;/PRE&gt;&lt;P&gt;I run clear through the IF, but I am getting an error on my first ELSE .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a missing value, arrayname, (, +, -, INPUT, NOT, PUT, ^, _NEW_, ~. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot figure out what's wrong with my syntax.&amp;nbsp; Can anyone help?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My objective is to group Net_Sales into categories so they display nicely on Cross Tab.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 21:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/504908#M1052</guid>
      <dc:creator>AMMAN</dc:creator>
      <dc:date>2018-10-16T21:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN ELSE Help</title>
      <link>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/504910#M1054</link>
      <description>&lt;P&gt;see if this correction helps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data work.ifthen;
set work.pelicanstores;
if Net_Sales &amp;lt; 50 THEN Sales = "0-$50";
ELSE IF Net_Sales &amp;gt; 51 AND Net_Sales&amp;lt; 100 then  Sales = "$51-$100";
ELSE IF Net_Sales &amp;gt; 100 AND Net_Sales&amp;lt;200 then Sales = "$101-$200";
ELSE IF Net_Sales &amp;gt; 200 then  Sales ="$200+";

Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.ifthen;
set work.pelicanstores;
if Net_Sales &amp;lt; 50 THEN Sales = "0-$50";
ELSE IF   51&amp;lt;  Net_Sales&amp;lt; 100 then  Sales = "$51-$100";
ELSE IF  100&amp;lt;  Net_Sales&amp;lt;200 then Sales = "$101-$200";
ELSE IF Net_Sales &amp;gt; 200 then  Sales ="$200+";

Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 21:31:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/504910#M1054</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-16T21:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN ELSE Help</title>
      <link>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/504911#M1055</link>
      <description>&lt;P&gt;if the above works, make sure to add a length statement for sales to accommodate the values and avoid truncation&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 21:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/504911#M1055</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-16T21:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN ELSE Help</title>
      <link>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/504913#M1056</link>
      <description>&lt;P&gt;One step closer!&amp;nbsp;&amp;nbsp; I am getting some weird results in the new variable.&amp;nbsp; Why is the second part missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="weird results.JPG" style="width: 86px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24066i286C2507CD9F473B/image-size/large?v=v2&amp;amp;px=999" role="button" title="weird results.JPG" alt="weird results.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 21:35:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/504913#M1056</guid>
      <dc:creator>AMMAN</dc:creator>
      <dc:date>2018-10-16T21:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN ELSE Help</title>
      <link>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/504914#M1057</link>
      <description>You read my mind!</description>
      <pubDate>Tue, 16 Oct 2018 21:35:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/504914#M1057</guid>
      <dc:creator>AMMAN</dc:creator>
      <dc:date>2018-10-16T21:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN ELSE Help</title>
      <link>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/505089#M1094</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/221595"&gt;@AMMAN&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;data work.ifthen;
set work.pelicanstores;
if Net_Sales &amp;lt; 50 THEN Sales = "0-$50";
ELSE IF Net_Sales &amp;gt; 51 AND &amp;lt; 100 Sales = "$51-$100";
ELSE IF Net_Sales &amp;gt; 100 AND &amp;lt;200 Sales = "$101-$200";
ELSE IF Net_Sales &amp;gt; 200 Sales ="$200+";

Run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your ranges have gaps LT 50 then GT 51.&amp;nbsp; Also the labels are not clear&amp;nbsp; "0-$50" but 50 is not included in the range.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would use a VALUE format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
   value sales 
      0    - 50    = '$0-$50'
      50&amp;lt;  - 100   = '&amp;gt;$50-$100'
      100&amp;lt; - 200   = '&amp;gt;$100-$200'
      200  - high  = '200+'
      ;
   quit; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Oct 2018 13:55:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/505089#M1094</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2018-10-17T13:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN ELSE Help</title>
      <link>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/505187#M1113</link>
      <description>&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 16:03:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/IF-THEN-ELSE-Help/m-p/505187#M1113</guid>
      <dc:creator>AMMAN</dc:creator>
      <dc:date>2018-10-17T16:03:48Z</dc:date>
    </item>
  </channel>
</rss>

