<?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 Else Error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455984#M115447</link>
    <description>&lt;P&gt;I ran the code that&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;posted, which included the embedded *&amp;nbsp; ; comments, and it appeared to run perfectly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In fact, her example data showed a flaw that should be fixed in&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205856"&gt;@Amerie&lt;/a&gt;'s code. The conditions don't trap values of 0, thus they're incorrectly recoded as 2 (i.e., representing GE 14)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Apr 2018 16:23:59 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2018-04-20T16:23:59Z</dc:date>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455935#M115418</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am becoming reacquainted with SAS after a long hiatus and am having trouble with some code. I am trying to recode a variable using the if-else statement and am continuously getting an error message. I can't seem to figure out the issue. I am working with BRFSS data. Any suggestions on what the problem may be?&amp;nbsp; Thank you in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if POORHLTH in (77,99,.) then ActsLimited=.;
	else if POORHLTH=88 then ActsLimited=0; *0 Days activities limited by poor health;
	else if 1 le POORHLTH le 13 then ActsLimited=1; *1-13 Days activities limited by poor health;
	else ActsLimited=2; *14 or more days activities limited due to poor health;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Apr 2018 14:37:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455935#M115418</guid>
      <dc:creator>Amerie</dc:creator>
      <dc:date>2018-04-20T14:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455936#M115419</link>
      <description>&lt;P&gt;You're getting an error?????&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would you be kind enough to share it with us? We want to see the SASLOG, or other indication of the error.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 14:43:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455936#M115419</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-04-20T14:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455950#M115427</link>
      <description>&lt;P&gt;I am! And cannot figure out why.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here it is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;59 if POORHLTH in (77,99,.) then ActsLimited=.;&lt;BR /&gt;--&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;60 else if POORHLTH=88 then ActsLimited=0;&lt;BR /&gt;----&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;61 else if 1 le POORHLTH le 13 then ActsLimited=1;&lt;BR /&gt;----&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;62 else ActsLimited=2;&lt;BR /&gt;----&lt;BR /&gt;180&lt;/P&gt;&lt;P&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/P&gt;&lt;P&gt;63 run;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 14:56:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455950#M115427</guid>
      <dc:creator>Amerie</dc:creator>
      <dc:date>2018-04-20T14:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455954#M115428</link>
      <description>&lt;P&gt;Show the entire data step code.&lt;/P&gt;
&lt;P&gt;And best is to paste into a code box opened with the forums {I} menu icon. The message windows will reformat text moving such things as the _ character SAS places under the location of the found error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You did have this in a block of code that started with something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data new;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set old;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; if PoorHealth in (77,99,.) then ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;didn't you?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 15:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455954#M115428</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-20T15:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455955#M115429</link>
      <description>&lt;P&gt;You'd have to show you whole datastep. Your likely just missing a semi-colon or something on one of the lines preceding the code you showed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 15:04:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455955#M115429</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-04-20T15:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455957#M115430</link>
      <description>&lt;P&gt;Data steps need to start with a data command and a dataset to output to.&amp;nbsp; Then they might have a set command or a merge command or other statements:&lt;/P&gt;
&lt;PRE&gt;data &amp;lt;dataset&amp;gt;;
  set &amp;lt;dataset&amp;gt;;


or 
data &amp;lt;dataset&amp;gt;;
  merge &amp;lt;dataset1&amp;gt; &amp;lt;dataset2&amp;gt;;
  by &amp;lt;variables&amp;gt;;
&lt;/PRE&gt;
&lt;P&gt;The error is telling you a command if outside a datastep is not valid.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 15:07:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455957#M115430</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-20T15:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455958#M115431</link>
      <description>&lt;P&gt;Since there's nothing wrong with the code shown the error is above the section indicated in your posts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205856"&gt;@Amerie&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am becoming reacquainted with SAS after a long hiatus and am having trouble with some code. I am trying to recode a variable using the if-else statement and am continuously getting an error message. I can't seem to figure out the issue. I am working with BRFSS data. Any suggestions on what the problem may be?&amp;nbsp; Thank you in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if POORHLTH in (77,99,.) then ActsLimited=.;
	else if POORHLTH=88 then ActsLimited=0; *0 Days activities limited by poor health;
	else if 1 le POORHLTH le 13 then ActsLimited=1; *1-13 Days activities limited by poor health;
	else ActsLimited=2; *14 or more days activities limited due to poor health;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205856"&gt;@Amerie&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am becoming reacquainted with SAS after a long hiatus and am having trouble with some code. I am trying to recode a variable using the if-else statement and am continuously getting an error message. I can't seem to figure out the issue. I am working with BRFSS data. Any suggestions on what the problem may be?&amp;nbsp; Thank you in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if POORHLTH in (77,99,.) then ActsLimited=.;
	else if POORHLTH=88 then ActsLimited=0; *0 Days activities limited by poor health;
	else if 1 le POORHLTH le 13 then ActsLimited=1; *1-13 Days activities limited by poor health;
	else ActsLimited=2; *14 or more days activities limited due to poor health;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 15:08:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455958#M115431</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-20T15:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455959#M115432</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA Health2018; SET php1.finalvar;

/*Poor Health*/
if POORHLTH in (77,99,.) then ActsLimited=.;
	else if POORHLTH=88 then ActsLimited=0; *0 Days activities limited by poor health;
	else if 1 le POORHLTH le 13 then ActsLimited=1; *1-13 Days activities limited by poor health;
	else ActsLimited=2; *14 or more days activities limited due to poor health;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Apr 2018 15:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455959#M115432</guid>
      <dc:creator>Amerie</dc:creator>
      <dc:date>2018-04-20T15:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455962#M115433</link>
      <description>&lt;P&gt;There's nothing inherently wrong with the code written.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post your log with&amp;nbsp; the full error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For demonstration purposes, this shows that your code works as expected:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
input poorhlth;
cards;
77
99
.
88
1
2
3
4
5
6
9
13
14
0
24
23
100
;
run;


DATA Health2018; SET demo;

/*Poor Health*/
if POORHLTH in (77,99,.) then ActsLimited=.;
	else if POORHLTH=88 then ActsLimited=0; *0 Days activities limited by poor health;
	else if 1 le POORHLTH le 13 then ActsLimited=1; *1-13 Days activities limited by poor health;
	else ActsLimited=2; *14 or more days activities limited due to poor health;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205856"&gt;@Amerie&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA Health2018; SET php1.finalvar;

/*Poor Health*/
if POORHLTH in (77,99,.) then ActsLimited=.;
	else if POORHLTH=88 then ActsLimited=0; *0 Days activities limited by poor health;
	else if 1 le POORHLTH le 13 then ActsLimited=1; *1-13 Days activities limited by poor health;
	else ActsLimited=2; *14 or more days activities limited due to poor health;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 15:16:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455962#M115433</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-20T15:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455978#M115442</link>
      <description>&lt;P&gt;For the first error, the advice you have received is sound.&amp;nbsp; We would need to see the entire DATA step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For most of the errors, the mistake is right there in your code.&amp;nbsp; The comment statements throw off the IF/THEN/ELSE logic.&amp;nbsp; You can't have a comment statement before an ELSE statement ... it removes the connection with the previous IF condition.&amp;nbsp; You could change all your comments statements:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* Not like this;&lt;/P&gt;
&lt;P&gt;/* but like this instead */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Embedded comments won't disconnect the IF THEN from the subsequent ELSE IF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the first error is still a mystery, and depends on what came prior to that in the program.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 16:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455978#M115442</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-20T16:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455980#M115443</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;{deleted}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For most of the errors, the mistake is right there in your code.&amp;nbsp; The comment statements throw off the IF/THEN/ELSE logic.&amp;nbsp; You can't have a comment statement before an ELSE statement ... it removes the connection with the previous IF condition.&amp;nbsp; You could change all your comments statements:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* Not like this;&lt;/P&gt;
&lt;P&gt;/* but like this instead */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Embedded comments won't disconnect the IF THEN from the subsequent ELSE IF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the first error is still a mystery, and depends on what came prior to that in the program.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't think that's true, you can have comments within the IF/ELSE IF statements regardless of type.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 16:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455980#M115443</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-20T16:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455981#M115444</link>
      <description>&lt;P&gt;It's been probably 30 years since I tested this, but I doubt it has changed.&amp;nbsp; I'm just not in a position to test it until Monday.&amp;nbsp; Let us know what you find out.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 16:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455981#M115444</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-20T16:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455984#M115447</link>
      <description>&lt;P&gt;I ran the code that&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;posted, which included the embedded *&amp;nbsp; ; comments, and it appeared to run perfectly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In fact, her example data showed a flaw that should be fixed in&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205856"&gt;@Amerie&lt;/a&gt;'s code. The conditions don't trap values of 0, thus they're incorrectly recoded as 2 (i.e., representing GE 14)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 16:23:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455984#M115447</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-04-20T16:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455991#M115453</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;it works fine. However, adding apostrophe's to comments within a macro using * is a good way to introduce random errors into your work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 16:29:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455991#M115453</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-20T16:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455993#M115455</link>
      <description>&lt;P&gt;Thank you. You were correct.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 16:31:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455993#M115455</guid>
      <dc:creator>Amerie</dc:creator>
      <dc:date>2018-04-20T16:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455994#M115456</link>
      <description>&lt;P&gt;Thank you. The code was correct. Something was going on outside of the datastep that I was unable to see. I rearranged and recoded it and it ran. Thank you again.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 16:33:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455994#M115456</guid>
      <dc:creator>Amerie</dc:creator>
      <dc:date>2018-04-20T16:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455995#M115457</link>
      <description>Thank you all! &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt; that was my conclusion as well and I fixed it accordingly! Thank you all again so much. I really appreciate you taking the time to help me with this.</description>
      <pubDate>Fri, 20 Apr 2018 16:35:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/455995#M115457</guid>
      <dc:creator>Amerie</dc:creator>
      <dc:date>2018-04-20T16:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/456001#M115463</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I ran the code that&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;posted, which included the embedded *&amp;nbsp; ; comments, and it appeared to run perfectly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In fact, her example data showed a flaw that should be fixed in&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205856"&gt;@Amerie&lt;/a&gt;'s code. The conditions don't trap values of 0, thus they're incorrectly recoded as 2 (i.e., representing GE 14)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;This is very specific to the BRFSS (Behavioral Risk Factor Surveillance System) data. The survey data question collection coding does not allow 0 to be entered for this data point (and most others). The code value&amp;nbsp;of 88 on the first test is for respondent answers of 0 or None.&lt;/P&gt;
&lt;P&gt;The data is "trapped" in effect for that value by CDC before the analysts receive the data.&lt;/P&gt;
&lt;P&gt;Which is also why none of the other values between 30 and 77, 77 to 88 or 88 to 99 are tested or coded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Former BRFSS data collection contractor and occasional analyst)&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 16:55:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/456001#M115463</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-20T16:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/456045#M115474</link>
      <description>&lt;P&gt;The problem actually happens in macro code.&amp;nbsp; If you try to use statement style comments (* ... &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; between macro %if/%else it will confuse the connection between the %if and the %else. Macro comments or block comments are ok there.&lt;/P&gt;
&lt;PRE&gt;2311  %macro test1(x);
2312  %if x1=1 %then %do; ageX=1; %end;
2313   * statement comment ;
2314  %else %do ;  ageX=0; %end;
ERROR: There is no matching %IF statement for the %ELSE.
ERROR: A dummy macro will be compiled.
2315  %mend test1;

2316  %macro test2(x);
2317  %if x1=1 %then %do; ageX=1; %end;
2318   %* macro comment ;
2319  %else %do ;  ageX=0; %end;
2320  %mend test2;

2321  %macro test3(x);
2322  %if x1=1 %then %do; ageX=1; %end;
2323   /* block comment */
2324  %else %do ;  ageX=0; %end;
2325  %mend test3;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;{deleted}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For most of the errors, the mistake is right there in your code.&amp;nbsp; The comment statements throw off the IF/THEN/ELSE logic.&amp;nbsp; You can't have a comment statement before an ELSE statement ... it removes the connection with the previous IF condition.&amp;nbsp; You could change all your comments statements:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* Not like this;&lt;/P&gt;
&lt;P&gt;/* but like this instead */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Embedded comments won't disconnect the IF THEN from the subsequent ELSE IF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the first error is still a mystery, and depends on what came prior to that in the program.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't think that's true, you can have comments within the IF/ELSE IF statements regardless of type.&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 19:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/456045#M115474</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-20T19:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: If Else Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/456059#M115480</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;Yes, that's correct. If you use *; style comments in a macro you'll likely have issues. You need to use either:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%*&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/**/ to comment in a macro.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Apr 2018 20:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Re-If-Else-Error/m-p/456059#M115480</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-20T20:10:19Z</dc:date>
    </item>
  </channel>
</rss>

