<?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 block in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318916#M69934</link>
    <description>&lt;P&gt;Using the same style of syntax that you have been, your code is missing a &lt;FONT color="#FF0000"&gt;closing parenthesis&lt;/FONT&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;else if ((One_Day_Un_Return2=(' ' | '0.00%')&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;However, once that is cleared up, there are many more issues with the code. &amp;nbsp;I would guess that your intention is to check each&amp;nbsp;variable to see whether it is either blank or contains the text "0.00%". &amp;nbsp;If that's the case, the proper syntax would be:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;else if One_Day_Un_Return2 in (' ', ' 0.00%') ......;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;If your intention is something else you will have to add some details about it. &amp;nbsp;But even the fixed code (adding the parenthesis) will not run.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Dec 2016 13:06:21 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-12-14T13:06:21Z</dc:date>
    <item>
      <title>If then else block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318768#M69885</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am facing an systax error and expecting something after running this. Please guide me what is the correct one&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute Index_Id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if Index_Id = '0' then&lt;/P&gt;&lt;P&gt;call define(_row_,"style","style={just=1 font face=Arial font_style=italic font_size=2}");&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;if((Caol1=(' ' | '0.00%') and col2=(' ' | '0.00%'))&lt;/P&gt;&lt;P&gt;then do;&lt;/P&gt;&lt;P&gt;col1=' ';&lt;/P&gt;&lt;P&gt;col2=' ';&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me out.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 07:49:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318768#M69885</guid>
      <dc:creator>PujaDas</dc:creator>
      <dc:date>2016-12-14T07:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: If then else block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318771#M69886</link>
      <description>&lt;P&gt;You posted only a part of your program code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should post, also, the log with the syntx error you got.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or maybe your error is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;if((Caol1=(' ' | '0.00%') and col2=(' ' | '0.00%'))&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;should it be col1 instead Caol1 ???&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 08:15:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318771#M69886</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-12-14T08:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: If then else block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318772#M69887</link>
      <description>&lt;P&gt;Posting the log with the syntax error in a {i} window would greatly help &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From your earlier posts, I think that caol1 is not present in the dataset. And the only variables that can be used in the compute statement are group or order variables for a compute target.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 08:14:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318772#M69887</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-14T08:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: If then else block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318776#M69888</link>
      <description>&lt;P&gt;Sorry for creating the confusion.. i am changing no its col1.. i have done the typing mistake here..i have attachd the log here..&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13251iC0445AF40A200E4F/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="20161214_140328.jpg" title="20161214_140328.jpg" /&gt;</description>
      <pubDate>Wed, 14 Dec 2016 08:42:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318776#M69888</guid>
      <dc:creator>PujaDas</dc:creator>
      <dc:date>2016-12-14T08:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: If then else block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318779#M69889</link>
      <description>&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13252i07F80CC82F822A28/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="20161214_140328.jpg" title="20161214_140328.jpg" /&gt;</description>
      <pubDate>Wed, 14 Dec 2016 08:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318779#M69889</guid>
      <dc:creator>PujaDas</dc:creator>
      <dc:date>2016-12-14T08:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: If then else block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318781#M69890</link>
      <description>&lt;P&gt;The ERROR points to the "then" keyword, indicating a problem with the condition. Counting your parentheses I see 11 opening, but only 10 closing parentheses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once again you stumble into the "spaghetti code hole". As soon as logical code segments go beyond one line, proper use of indentation and linebreaks to separate the elements is a &lt;U&gt;&lt;STRONG&gt;MUST&lt;/STRONG&gt;&lt;/U&gt;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also make use of a feature of the enhanced editor: when putting the cursor to a closing parenthesis, the editor will show you the opening one that it thinks is paired with it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Seeing that you only have and's in your condition, most of your parentheses are unnecessary, anyway. Parentheses to separate condition elements are only necessary when "or" and "and" are mixed and the rule "and goes before or" has to be circumvented.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 08:52:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318781#M69890</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-14T08:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: If then else block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318782#M69891</link>
      <description>&lt;P&gt;And, BTW: just copy/paste the log into a {i} subwindow here; downloading the image takes time, and one can't copy/paste code from an image for testing/editing. Don't expect us to type code for you when it's absolutely not necessary.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 08:55:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318782#M69891</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-14T08:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: If then else block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318800#M69898</link>
      <description>&lt;P&gt;What the chaps above are asking is that you don't post pictures (or other documents) but use simple copy and paste functionality to copy the text from your program into the post you are writing. &amp;nbsp;It is annoying and difficult to use pictures for anything. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use the code window function in your posts. &amp;nbsp;Above where you type replies there is a tool bar containing {i}, and other tools icons. &amp;nbsp;Use this to post code and logs as it stands out and keeps formatting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now onto your problem. &amp;nbsp;As mentioned above, you have unbalanced quote, bracket or other containing special characters. &amp;nbsp;We can't tell really from that picture where it is. &amp;nbsp;So step through your code, check each line works. &amp;nbsp;Count that the number of ) = number of these (.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is could debugging and is something you will do all the time in programming. &amp;nbsp;Note you can comment out section of code by highlighting and pressing cntrl + shift + / and uncomment with cntrl + shift + \. &amp;nbsp;makes debugging easier.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 10:35:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318800#M69898</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-14T10:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: If then else block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318916#M69934</link>
      <description>&lt;P&gt;Using the same style of syntax that you have been, your code is missing a &lt;FONT color="#FF0000"&gt;closing parenthesis&lt;/FONT&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;else if ((One_Day_Un_Return2=(' ' | '0.00%')&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;However, once that is cleared up, there are many more issues with the code. &amp;nbsp;I would guess that your intention is to check each&amp;nbsp;variable to see whether it is either blank or contains the text "0.00%". &amp;nbsp;If that's the case, the proper syntax would be:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;else if One_Day_Un_Return2 in (' ', ' 0.00%') ......;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;If your intention is something else you will have to add some details about it. &amp;nbsp;But even the fixed code (adding the parenthesis) will not run.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 13:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/318916#M69934</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-12-14T13:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: If then else block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/319164#M70016</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your support.&lt;/P&gt;&lt;P&gt;Actually the requirement is to check the value of a column if '0.00%' then it would be blank.&lt;/P&gt;&lt;P&gt;First of all to check for a condition that if the value of a column is 0 then make it as '0.00%'. I have done it to make it as char fist using put() then || with percentage.Its working fine.&lt;/P&gt;&lt;P&gt;For the next case While I am trying to check if the column value is '0.00%' then make it as blank,dats not working. I feel that when I am trying to check if the value is equal to '0.00%' then make it as col1=' ' ,it simply make it as blank || %. which cant match the condition anymore. thats why expected output is not coming.&lt;/P&gt;&lt;P&gt;can you please help me how to resolve this one??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Puja&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2016 06:17:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/319164#M70016</guid>
      <dc:creator>PujaDas</dc:creator>
      <dc:date>2016-12-15T06:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: If then else block</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/319206#M70041</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you post some test data in the form of a datastep we could provide working code. &amp;nbsp;I am unsure as to why you need to convert a value before you check if it is 0 or not?&lt;/P&gt;
&lt;PRE&gt;data want;
  length want_text $20;
  input myval;
  want_text=ifc(myval=0,"",put(myval,percent7.1));
datalines;
0
0.345
;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Dec 2016 09:28:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-block/m-p/319206#M70041</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-15T09:28:33Z</dc:date>
    </item>
  </channel>
</rss>

