<?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: error expecting arithmetic operator in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481476#M124545</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As well as what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;has said, you might also want to consider using &lt;FONT face="courier new,courier"&gt;else&lt;/FONT&gt; if your conditions are mutually exclusive, e.g.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set sashelp.class;
   
   if age in (10,20,30) then
      flag = 1;
   else
      if age in (11,21,31) then
         flag = 2;
      else
         if age in (12,22,32) then
            flag = 3;
         else
            flag = 0;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jul 2018 13:05:46 GMT</pubDate>
    <dc:creator>Amir</dc:creator>
    <dc:date>2018-07-26T13:05:46Z</dc:date>
    <item>
      <title>error expecting arithmetic operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481469#M124543</link>
      <description>&lt;P&gt;Hi I am using SAS 9.4 and trying to create a new variable to include the following code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.RUCA_class;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; raw.raw_ruca18;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; RUCA30 = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1.0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1.1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;2.0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;2.1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;3.0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;4.1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;5.1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;7.1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;8.1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;10.1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; cat_A = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Urban Focused'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; RUCA30 = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;4.0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;4.2&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;5.0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;5.2&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;6.0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;6.1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; cat_A = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Large Rural City/Town (micropolitan) focused'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; RUCA30 = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;7.0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;7.2&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;7.3&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;7.4&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;8.0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;8.2&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;8.3&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;8.4&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;9.0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;9.1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;9.2&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; cat_A = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Small Rural Town Focused'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; RUCA30 = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;10.0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;10.2&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;10.3&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;10.4&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;10.5&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;10.6&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; cat_A = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Isolated Small Rural Town Focused'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;When I run this I get an error expecting an arithmetic operator. Any help on why this is not working would be great. Thank you! &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 12:48:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481469#M124543</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2018-07-26T12:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: error expecting arithmetic operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481474#M124544</link>
      <description>&lt;P&gt;Well first off we can't see your data or structure which does not help.&amp;nbsp; The first thing that jumps out at me is this:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;RUCA30 =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1.0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;1.1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;2.0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;2.1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;3.0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;4.1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;5.1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;7.1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;8.1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;10.1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;cat_A =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'Urban Focused'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Numeric variables can only have one decimal point.&amp;nbsp; Therefore if this ruca30 variable is numeric, this statement is invalid.&amp;nbsp; If it is character, then you need to put quotes arround it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Perhaps you mean it is a list of values something like:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;if ruca30 in (1,0.1,12...)&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Jul 2018 13:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481474#M124544</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-07-26T13:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: error expecting arithmetic operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481476#M124545</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As well as what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;has said, you might also want to consider using &lt;FONT face="courier new,courier"&gt;else&lt;/FONT&gt; if your conditions are mutually exclusive, e.g.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set sashelp.class;
   
   if age in (10,20,30) then
      flag = 1;
   else
      if age in (11,21,31) then
         flag = 2;
      else
         if age in (12,22,32) then
            flag = 3;
         else
            flag = 0;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 13:05:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481476#M124545</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2018-07-26T13:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: error expecting arithmetic operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481479#M124547</link>
      <description>&lt;P&gt;Besides switching to the IN operator (that eliminates the error message) you will also need to add this early in the DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length cat_A $ 35;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise cat_A receives its length from the first time it is mentioned and values longer than "Urban Focused" will be truncated.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 13:15:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481479#M124547</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-07-26T13:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: error expecting arithmetic operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481488#M124550</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.RUCA_class;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; work.RUCA_class;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; cat_A $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;35&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; RUCA30 = (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'1.0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'1.1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'2.0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'2.1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'3.0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'4.1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'5.1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'7.1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'8.1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'10.1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; cat_A = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Urban Focused'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; RUCA30 = (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'4.0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'4.2'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'5.0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'5.2'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'6.0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'6.1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; cat_A = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Large Rural City/Town (micropolitan) focused'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; RUCA30 = (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'7.0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'7.2'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'7.3'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'7.4'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'8.0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'8.2'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'8.3'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'8.4'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'9.0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'9.1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'9.2'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; cat_A = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Small Rural Town Focused'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; RUCA30 = (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'10.0'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'10.2'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'10.3'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'10.4'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'10.5'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'10.6'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; cat_A = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Isolated Small Rural Town Focused'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I converted the variable to a character and added the length but I am still getting the same error message. Am I not creating the variable 'cat_A' properly?&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 13:25:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481488#M124550</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2018-07-26T13:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: error expecting arithmetic operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481490#M124551</link>
      <description>&lt;P&gt;Instead of multiple if/then, use a select() block:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.RUCA_class;
set raw.raw_ruca18;
select (RUCA30);
  when ("1.0","1.1","2.0","2.1","3.0","4.1","5.1","7.1","8.1","10.1")
    cat_A = 'Urban Focused';
  when ("4.0","4.2","5.0","5.2","6.0","6.1")
    cat_A = 'Large Rural City/Town (micropolitan) focused';
  when ("7.0","7.2","7.3","7.4","8.0","8.2","8.3","8.4","9.0","9.1","9.2")
    cat_A = 'Small Rural Town Focused';
  when ("10.0","10.2","10.3","10.4","10.5","10.6")
    cat_A = 'Isolated Small Rural Town Focused';
  otherwise;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or contemplate using a format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $ruca
  "1.0" = 'Urban Focused'
  "1.1" = 'Urban Focused'
  "2.0" = 'Urban Focused'
  "2.1" = 'Urban Focused'
  "3.0" = 'Urban Focused'
  "4.1" = 'Urban Focused'
  "5.1" = 'Urban Focused'
  "7.1" = 'Urban Focused'
  "8.1" = 'Urban Focused'
  "10.1" = 'Urban Focused'
  "4.0" = 'Large Rural City/Town (micropolitan) focused'
  /* and so on */
  OTHER = ""
;
run;

data work.RUCA_class;
set raw.raw_ruca18;
cat_A = put(RUCA30,$ruca.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have a lookup table for the Rural Urban Commuting Area Codes, you can automate the creation of the format.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 13:29:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481490#M124551</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-26T13:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: error expecting arithmetic operator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481491#M124552</link>
      <description>&lt;P&gt;Look at the examples ... no equal sign, use the word IN instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if RUCA30 is a character variable, the code is otherwise correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's numeric, remove all the quotes around the numbers.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jul 2018 13:30:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/error-expecting-arithmetic-operator/m-p/481491#M124552</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-07-26T13:30:03Z</dc:date>
    </item>
  </channel>
</rss>

