<?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 Error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707296#M217144</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/361477"&gt;@gtbash&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Association of previous roles/experience to job effectiveness as a leader&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data diss.prtable;&lt;BR /&gt;set diss.prtable;&lt;BR /&gt;if instructional_coach = 2 then IC = 1 else IC = 0;&lt;BR /&gt;if intervention_specialist = 2 then IS = 1 else IS = 0;&lt;BR /&gt;if content_area_coach = 2 then AC = 1 else AC = 0;&lt;BR /&gt;if Title_1 = Y then T1 = 1 else T1 = 0;&lt;BR /&gt;if Site = Middle then MS = 1 else MS = 0;&lt;BR /&gt;if Site = High then HS = 1 else HS = 0;&lt;BR /&gt;if Site = K8 then K8 = 1 else K8 = 0;&lt;BR /&gt;if Site = Elementary then ES = 1 else ES = 0;&lt;BR /&gt;if IC = 1 or IS =1 or AC = 1 then role = 1 else role = 0;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;/P&gt;
&lt;P&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;/P&gt;
&lt;P&gt;498 run;&lt;/P&gt;
&lt;P&gt;NOTE: Character values have been converted to numeric values at the places given by:&lt;BR /&gt;(Line):(Column).&lt;BR /&gt;495:31&lt;BR /&gt;NOTE: Numeric values have been converted to character values at the places given by:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The error you made (in many places), is corrected with red below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if instructional_coach = 2 then IC = 1&lt;FONT size="4" color="#FF0000"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt; else IC = 0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the future, please do not show us the log disconnected from the code. Show us the entire log, all of it, for this data step, with nothing chopped out, so we can see the code as it appears in the log, the NOTEs, ERRORs and WARNINGs in the sequence that it all appears in the log.&lt;/P&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;</description>
    <pubDate>Sun, 20 Dec 2020 19:54:34 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-12-20T19:54:34Z</dc:date>
    <item>
      <title>If/then Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707291#M217141</link>
      <description>&lt;P&gt;Association of previous roles/experience to job effectiveness as a leader&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data diss.prtable;&lt;BR /&gt;set diss.prtable;&lt;BR /&gt;if instructional_coach = 2 then IC = 1 else IC = 0;&lt;BR /&gt;if intervention_specialist = 2 then IS = 1 else IS = 0;&lt;BR /&gt;if content_area_coach = 2 then AC = 1 else AC = 0;&lt;BR /&gt;if Title_1 = Y then T1 = 1 else T1 = 0;&lt;BR /&gt;if Site = Middle then MS = 1 else MS = 0;&lt;BR /&gt;if Site = High then HS = 1 else HS = 0;&lt;BR /&gt;if Site = K8 then K8 = 1 else K8 = 0;&lt;BR /&gt;if Site = Elementary then ES = 1 else ES = 0;&lt;BR /&gt;if IC = 1 or IS =1 or AC = 1 then role = 1 else role = 0;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;/P&gt;&lt;P&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;498 run;&lt;/P&gt;&lt;P&gt;NOTE: Character values have been converted to numeric values at the places given by:&lt;BR /&gt;(Line):(Column).&lt;BR /&gt;495:31&lt;BR /&gt;NOTE: Numeric values have been converted to character values at the places given by:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 19:31:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707291#M217141</guid>
      <dc:creator>gtbash</dc:creator>
      <dc:date>2020-12-20T19:31:23Z</dc:date>
    </item>
    <item>
      <title>If then Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707289#M217143</link>
      <description>&lt;P&gt;Association of previous roles/experience to job effectiveness as a leader&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data diss.prtable;&lt;BR /&gt;set diss.prtable;&lt;BR /&gt;if instructional_coach = 2 then IC = 1 else IC = 0;&lt;BR /&gt;if intervention_specialist = 2 then IS = 1 else IS = 0;&lt;BR /&gt;if content_area_coach = 2 then AC = 1 else AC = 0;&lt;BR /&gt;if Title_1 = Y then T1 = 1 else T1 = 0;&lt;BR /&gt;if Site = Middle then MS = 1 else MS = 0;&lt;BR /&gt;if Site = High then HS = 1 else HS = 0;&lt;BR /&gt;if Site = K8 then K8 = 1 else K8 = 0;&lt;BR /&gt;if Site = Elementary then ES = 1 else ES = 0;&lt;BR /&gt;if IC = 1 or IS =1 or AC = 1 then role = 1 else role = 0;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;/P&gt;&lt;P&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;498 run;&lt;/P&gt;&lt;P&gt;NOTE: Character values have been converted to numeric values at the places given by:&lt;BR /&gt;(Line):(Column).&lt;BR /&gt;495:31&lt;BR /&gt;NOTE: Numeric values have been converted to character values at the places given by:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 19:25:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707289#M217143</guid>
      <dc:creator>gtbash</dc:creator>
      <dc:date>2020-12-20T19:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: If/then Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707295#M217142</link>
      <description>&lt;P&gt;Start here and see if any errors remain:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The ELSE statement is a separate statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In every case, the previous IF THEN statement has to end with a semicolon.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 19:51:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707295#M217142</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-12-20T19:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: If then Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707296#M217144</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/361477"&gt;@gtbash&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Association of previous roles/experience to job effectiveness as a leader&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data diss.prtable;&lt;BR /&gt;set diss.prtable;&lt;BR /&gt;if instructional_coach = 2 then IC = 1 else IC = 0;&lt;BR /&gt;if intervention_specialist = 2 then IS = 1 else IS = 0;&lt;BR /&gt;if content_area_coach = 2 then AC = 1 else AC = 0;&lt;BR /&gt;if Title_1 = Y then T1 = 1 else T1 = 0;&lt;BR /&gt;if Site = Middle then MS = 1 else MS = 0;&lt;BR /&gt;if Site = High then HS = 1 else HS = 0;&lt;BR /&gt;if Site = K8 then K8 = 1 else K8 = 0;&lt;BR /&gt;if Site = Elementary then ES = 1 else ES = 0;&lt;BR /&gt;if IC = 1 or IS =1 or AC = 1 then role = 1 else role = 0;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;/P&gt;
&lt;P&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;/P&gt;
&lt;P&gt;498 run;&lt;/P&gt;
&lt;P&gt;NOTE: Character values have been converted to numeric values at the places given by:&lt;BR /&gt;(Line):(Column).&lt;BR /&gt;495:31&lt;BR /&gt;NOTE: Numeric values have been converted to character values at the places given by:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The error you made (in many places), is corrected with red below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if instructional_coach = 2 then IC = 1&lt;FONT size="4" color="#FF0000"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/FONT&gt; else IC = 0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the future, please do not show us the log disconnected from the code. Show us the entire log, all of it, for this data step, with nothing chopped out, so we can see the code as it appears in the log, the NOTEs, ERRORs and WARNINGs in the sequence that it all appears in the log.&lt;/P&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;</description>
      <pubDate>Sun, 20 Dec 2020 19:54:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707296#M217144</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-20T19:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: If/then Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707304#M217145</link>
      <description>&lt;P&gt;I merged the duplicate postings into one post.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error message in the SAS log will show where the error is.&amp;nbsp; Copy the text from the SAS log and paste into window opened with the Insert Code button (looks like &amp;lt; / &amp;gt; ) to share on the forum.&lt;/P&gt;
&lt;P&gt;Here is an example of what the error message will look like:&lt;/P&gt;
&lt;PRE&gt;131  data want;
132    set have;
133    if instructional_coach = 2 then IC = 1 else IC = 0;
                                              ----
                                              388
                                              202
ERROR 388-185: Expecting an arithmetic operator.

ERROR 202-322: The option or parameter is not recognized and will be ignored.

134  run;&lt;/PRE&gt;
&lt;P&gt;So the word ELSE is flagged.&amp;nbsp; To SAS it looks like you are trying to set IC to the value :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1 else IC = 0&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So it is complaining because there is no operator between the numeric literal 1 and the reference to the variable named ELSE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are missing the semi-colon that marks the end of the IF statement.&amp;nbsp; So you have merged the IF and ELSE statements into one statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if instructional_coach = 2 then IC = 1;
else IC = 0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 01:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707304#M217145</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-12-21T01:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: If/then Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707311#M217151</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 22:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707311#M217151</guid>
      <dc:creator>gtbash</dc:creator>
      <dc:date>2020-12-20T22:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: If then Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707313#M217153</link>
      <description>&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 22:11:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-Error/m-p/707313#M217153</guid>
      <dc:creator>gtbash</dc:creator>
      <dc:date>2020-12-20T22:11:06Z</dc:date>
    </item>
  </channel>
</rss>

