<?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 in a macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866845#M342343</link>
    <description>&lt;P&gt;Yes, if your macro variable is storing a dot instead of being null, that is the problem.&amp;nbsp; It's not actually null / blank.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you change that?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can't then you can change your %IF statement to check if the value of the macro variable is a dot, e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;type ne . %then ... ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That will do a character comparison to test where the macro variable TYPE has the value dot.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 19:14:19 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2023-03-28T19:14:19Z</dc:date>
    <item>
      <title>if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866643#M342265</link>
      <description>&lt;P&gt;Hello SAS users&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on translating a code written by someone else and need help in understanding the syntax as it is not working as expected.&lt;/P&gt;&lt;P&gt;The code is using if then else statement in the macro with a where condition on the type which holds 1 or 2 value.&lt;/P&gt;&lt;P&gt;Macro Start&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create table tbl1 as&lt;/P&gt;&lt;P&gt;(select&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;%if &amp;amp;type&amp;gt; ' ' %then AND P.type_C = &amp;amp;type;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;&lt;P&gt;Macro End&lt;/P&gt;&lt;P&gt;Can somone explain me what does this if then and do here.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 21:52:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866643#M342265</guid>
      <dc:creator>Froebel</dc:creator>
      <dc:date>2023-03-27T21:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866647#M342267</link>
      <description>&lt;P&gt;It's not clear whether the program is correct or not, but I can tell you what it does.&amp;nbsp; It is considering whether or not to add this to the SAS code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;AND P.type_C = &amp;amp;type&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So you need to now the value of &amp;amp;TYPE to determine what happens.&lt;/P&gt;
&lt;P&gt;If the program is intending to check whether &amp;amp;TYPE has been assigned any value at all, it is incorrect.&amp;nbsp; Checking for &amp;gt;' ' is not the way to do it.&amp;nbsp; But it may be correct, it's just not possible to tell the intention of the programmer.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 22:26:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866647#M342267</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-03-27T22:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866654#M342269</link>
      <description>&lt;P&gt;It is not a good idea to ask questions about "what does this do" without providing&lt;/P&gt;
&lt;P&gt;1) ALL of the code in the step in question&lt;/P&gt;
&lt;P&gt;and when there is a comment like "not working as expected." provide what is expected. Which may require providing data, and in the case of macros and example of how you actually called the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I &lt;STRONG&gt;strongly&amp;nbsp; suspect&lt;/STRONG&gt; that you may have left out something important when you removed stuff like the variables selected and the From, like most of the WHERE clause.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I had to make a bet what the original programmer intended, given a very incomplete code example, I would say this is supposed to add a condition to the WHERE clause then the TYPE parameter is not blank. As shown it will generate errors because there would be a partial clause that is syntactically incorrect. You can't have an AND without something else&lt;BR /&gt;"where and P.type=&amp;lt;whatever type resolves to&amp;gt;" as well as the error that there is not alias P defined in the From.&lt;/P&gt;
&lt;P&gt;Actual working example using similar code. This writes to the results window for examination of results.&lt;/P&gt;
&lt;PRE&gt;%macro dummy( skip);
   proc sql;
      select * 
      from sashelp.class
      where sex='F'
        %if &amp;amp;skip &amp;gt; ' ' %then And age&amp;gt;14;
      ;
   quit; 
%mend;

/* select all the Female observations*/
%dummy()  ;

/* select all the Female observations with age &amp;gt; 14*/
%dummy (A);&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="5" color="#FF0000"&gt;&lt;STRONG&gt;HOWEVER &lt;/STRONG&gt;&lt;/FONT&gt;this is a logic error. Because it is actually comparing the value of TYPE to the character single quote and if type has a value like space, !, #, $ or % (and a few others) then type is not missing and the filter will not be applied.&lt;/P&gt;
&lt;P&gt;My example above works because A is "greater than", meaning after, the single quote in the collating sequence of characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: SAS Macros start with a %macro statement and finish with %Mend; When asking about a macro behavior everything between the %macro and %mend should be provided.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can see what the code generated by you macro is by using the option Mprint before executing the macro:&lt;/P&gt;
&lt;PRE&gt;options mprint;

%nameofmacro(&amp;lt;parameters to the macro)

options nomprint; /* turn of the macro print*/&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Mar 2023 00:10:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866654#M342269</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-28T00:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866668#M342277</link>
      <description>&lt;P&gt;Thank you, I think I understand it now. The program is pretty long but I will try to give you full details.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format;&lt;BR /&gt;value type1 = 'Female' 2 = 'Male' ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my program, it is using an excel which has value 1 in the Type Field and min age is also populated with value like &amp;gt;20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;macro master;&lt;/P&gt;&lt;P&gt;%put &amp;amp;type.;&amp;nbsp; &amp;nbsp;It prints 1 for me&lt;/P&gt;&lt;P&gt;select age, type, name, orderdate, code&lt;/P&gt;&lt;P&gt;from&amp;nbsp;&lt;/P&gt;&lt;P&gt;table P&lt;/P&gt;&lt;P&gt;where&amp;nbsp;&lt;/P&gt;&lt;P&gt;code in ('5435','4234',786')&amp;nbsp;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&amp;nbsp; %if &amp;amp;type. &amp;gt; ' ' %then AND p.type_c = &amp;amp;type;&lt;/P&gt;&lt;P&gt;%if &amp;amp;minage. &amp;gt; ' ' %then AND TRUNC(months_between(orderdate, BIRTH_DATE) / 12) &amp;amp;minage.;&lt;/P&gt;&lt;P&gt;and line =1&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%mend master;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However this code errors out when there is no value in the type field ..in the error message it prints missing expression and it prints p.type_c = .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like you both mentioned the&amp;nbsp; &amp;gt;'&amp;nbsp; ' is not working as expected.&lt;/P&gt;&lt;P&gt;Type only has value 1 or 2 or blank&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 04:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866668#M342277</guid>
      <dc:creator>Froebel</dc:creator>
      <dc:date>2023-03-28T04:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866669#M342278</link>
      <description>Thank you, I appreciate your response and I realize i should have provided more details. I have added the required code snippet, like you noted there is an error in the part where i am checking for null condition but what is it?</description>
      <pubDate>Tue, 28 Mar 2023 04:27:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866669#M342278</guid>
      <dc:creator>Froebel</dc:creator>
      <dc:date>2023-03-28T04:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866678#M342279</link>
      <description>&lt;P&gt;Your conditional codes in the %IF%THEN all start with an AND, but right before them you already have an unconditional AND, so yout get a double AND, which is invalid syntax.&lt;/P&gt;
&lt;P&gt;And the check for a non-empty type should be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if "&amp;amp;type." ne ""&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Mar 2023 06:32:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866678#M342279</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-28T06:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866710#M342296</link>
      <description>&lt;P&gt;If you are certain that the code is trying to test for a null value in &amp;amp;TYPE, there are a few ways to do it.&amp;nbsp; An entire paper has been written on the subject.&amp;nbsp; But the chosen method is not a valid way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;type. &amp;gt; ' ' %then AND p.type_c = &amp;amp;type;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This method is not correct, because macro language treats quotes as text in that statement.&amp;nbsp; So the test is whether &amp;amp;type is greater than a quote (or greater than two quotes).&amp;nbsp; The method I usually choose (and reasonable people can select alternatives) is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %length(&amp;amp;type.) &amp;gt; 0 %then AND p.type_c = &amp;amp;type;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Mar 2023 12:12:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866710#M342296</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-03-28T12:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866716#M342298</link>
      <description>&lt;P&gt;The paper&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;mentions is a classic, and worth a read:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings09/022-2009.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings09/022-2009.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The authors recommend:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro isBlank(param);
%sysevalf(%superq(param)=,boolean)
%mend isBlank;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So your code would be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if NOT %isblank(type) %then AND p.type_c = &amp;amp;type;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 12:38:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866716#M342298</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-03-28T12:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866743#M342312</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/431894"&gt;@Froebel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you, I appreciate your response and I realize i should have provided more details. I have added the required code snippet, like you noted there is an error in the part where i am checking for null condition but what is it?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Part of the issue could well be where the macro variables Type and Minage are set. You do not show that anywhere.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure what you are expecting for a result as there is no data accompanying the macro or the expected result. Adding the MINAGE added another syntax issue:&lt;/P&gt;
&lt;PRE&gt; AND TRUNC(months_between(orderdate, BIRTH_DATE) / 12) &amp;amp;minage.;&lt;/PRE&gt;
&lt;P&gt;I don't find any documentation for a MONTHS_BETWEEN function in SAS. Is that some locally defined function (typically for such I would expect to see the INTCK function). And regardless the use of "And trunc(somevalue) &amp;amp;minage." will be a syntax error.&lt;/P&gt;
&lt;P&gt;Suggestion: Turn on the option MPRINT as I showed above. Run your macro. Go to the log and copy the result of running your macro with all the MPINT notes. On the forum open a text box and paste that text. I strongly suspect you will see at least one if not more error messages.&lt;/P&gt;
&lt;P&gt;You may have not been bothering to tell us about the errors you are receiving from the code because the default error messages shown after a macro runs are bit difficult to connect with specific statements. The MPRINT option will make the errors appear in closer proximity to the code causing them.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 15:01:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866743#M342312</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-03-28T15:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866762#M342320</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I tried your version&lt;BR /&gt;&lt;BR /&gt;%macro dummy;&lt;BR /&gt;%DO COUNTER = 1 %TO 3;&lt;BR /&gt;DATA Temp;&lt;BR /&gt;SET CTRL;&lt;BR /&gt;IF ObsNo = &amp;amp;COUNTER;&lt;BR /&gt;call symputx ('sex',sex);&lt;BR /&gt;call symputx ('labels',compress(labels));&lt;BR /&gt;RUN;&lt;BR /&gt;%put &amp;amp;sex.;&lt;BR /&gt;proc sql;&lt;BR /&gt;select *&lt;BR /&gt;from sashelp.class&lt;BR /&gt;where age = 14&lt;BR /&gt;%if %length(&amp;amp;sex.) &amp;gt; 0 %then AND name = 'Henry';&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%dummy;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I uploaded the excel in the ctrl sas table and then I am using the sex &amp;amp; label columns to pass it as a variable in the sql. Sex has value 1 in the first row , 2 in the second and blank in the third. I was expecting the third row to bring all results since it is not greater than 0 but it brings only Henry as its output.</description>
      <pubDate>Tue, 28 Mar 2023 16:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866762#M342320</guid>
      <dc:creator>Froebel</dc:creator>
      <dc:date>2023-03-28T16:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866764#M342321</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Froebel_0-1680021553361.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82122iA9403FFEC0BDD5B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Froebel_0-1680021553361.png" alt="Froebel_0-1680021553361.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 16:39:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866764#M342321</guid>
      <dc:creator>Froebel</dc:creator>
      <dc:date>2023-03-28T16:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866768#M342322</link>
      <description>&lt;P&gt;Your program contains this line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;sex;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will need to show us the results of that %PUT statement, from the log.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 16:53:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866768#M342322</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-03-28T16:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866770#M342323</link>
      <description>&lt;P&gt;Your dummy code works for me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ctrl ;
  input ObSNo Sex $1. ;
  cards ;
1 M
2 F
3 .
;
run ;

%macro dummy;
%DO COUNTER = 1 %TO 3;
DATA Temp;
SET CTRL;
IF ObsNo = &amp;amp;COUNTER;
call symputx ('sex',sex);
RUN;
%put &amp;amp;sex.;
proc sql;
select *
from sashelp.class
where age = 14
%if %length(&amp;amp;sex.) &amp;gt; 0 %then AND name = 'Henry';
;
quit;
%end;
%mend;
%dummy;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have a global macro variable named sex, that could be part of the problem. Your dummy macro will be safer if you add a %LOCAL statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%local sex counter ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also make sure there is a record in your CTRL data with ObsNo=3.&amp;nbsp; If there is no record with ObsNo=3, then when &amp;amp;Counter=3 the macro variable SEX will still have the value assigned from &amp;amp;Counter=2.&amp;nbsp; To avoid this, you could initialize SEX to blank at the top of the %do loop:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%DO COUNTER = 1 %TO 3;
  %let sex= ; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;*...&amp;nbsp;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you turn on options MPRINT SYMBOLGEN it should make it easier to trace what is happening in the log.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 17:05:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866770#M342323</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-03-28T17:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866831#M342336</link>
      <description>I checked the length and it is bringing 1 for all three value , 1 , 2 and .</description>
      <pubDate>Tue, 28 Mar 2023 18:53:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866831#M342336</guid>
      <dc:creator>Froebel</dc:creator>
      <dc:date>2023-03-28T18:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866834#M342339</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/431894"&gt;@Froebel&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I checked the length and it is bringing 1 for all three value , 1 , 2 and .&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That would only happen if the value of the macro variable is a dot, rather than being blank.&amp;nbsp; In the macro language, a dot is a value.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 18:57:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866834#M342339</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-03-28T18:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866840#M342341</link>
      <description>Thank you for your response but all the values are bringing the same value for isblank(type). If type is 1 ,2 or . the isblank is bringing 0 for it. So I cant use this for checking non null values. It is storing the null with a . and thats causing all the confusion.&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Mar 2023 19:08:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866840#M342341</guid>
      <dc:creator>Froebel</dc:creator>
      <dc:date>2023-03-28T19:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: if then else in a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866845#M342343</link>
      <description>&lt;P&gt;Yes, if your macro variable is storing a dot instead of being null, that is the problem.&amp;nbsp; It's not actually null / blank.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you change that?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can't then you can change your %IF statement to check if the value of the macro variable is a dot, e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;type ne . %then ... ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That will do a character comparison to test where the macro variable TYPE has the value dot.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 19:14:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-then-else-in-a-macro/m-p/866845#M342343</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-03-28T19:14:19Z</dc:date>
    </item>
  </channel>
</rss>

