<?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: How to express the p value when &amp;lt;.0001 in %IF statement. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673275#M202505</link>
    <description>Thanks for your reply! However, it doesn't work. It still only outputs the means.</description>
    <pubDate>Wed, 29 Jul 2020 19:10:41 GMT</pubDate>
    <dc:creator>RosieSAS</dc:creator>
    <dc:date>2020-07-29T19:10:41Z</dc:date>
    <item>
      <title>How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673255#M202495</link>
      <description>&lt;P&gt;What I'm trying to do is to compare means after treatment p&amp;lt;0.05. First I saved p value through PROC SQL, then according to the p value to decide if needing to group the means or not. However, when p&amp;lt;.0001, the macro function %lsmeansOutput(P) always runs without LINES option as p&amp;gt;=0.05. When there is an exact p value&amp;lt;0.05, for example p=0.025, the macro function works correctly to show the mean grouping results.&lt;/P&gt;&lt;P&gt;Is there anyone can help me figure out the reason?&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ; ** obtain p-value of trt;
	select ProbF as intP into :intP 
	from Fixedp	where Effect='Treatment';
run;

%macro lsmeansOutput (P);
  %if &amp;amp;P&amp;lt;0.05 %then %do;
    proc plm restore=&amp;amp;response.out;
	ods exclude diffplot meanplot classlevels;
        lsmeans treatment/lines;
    run;
  %end;
  %else %do;
    proc plm restore=&amp;amp;response.out;
	ods exclude diffplot meanplot classlevels;
        lsmeans treatment;
    run;    
  %end;    
%mend lsmeansOutput;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 18:39:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673255#M202495</guid>
      <dc:creator>RosieSAS</dc:creator>
      <dc:date>2020-07-29T18:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673267#M202501</link>
      <description>&lt;P&gt;When you extract the value from the db make sure to get the raw number not the formatted value. And when doing numerical comparisons with decimals wrap it in %SYSEVALF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %sysevalf(&amp;amp;P&amp;lt;0.05) %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/251676"&gt;@RosieSAS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;What I'm trying to do is to compare means after treatment p&amp;lt;0.05. First I saved p value through PROC SQL, then according to the p value to decide if needing to group the means or not. However, when p&amp;lt;.0001, the macro function %lsmeansOutput(P) always runs without LINES option as p&amp;gt;=0.05. When there is an exact p value&amp;lt;0.05, for example p=0.025, the macro function works correctly to show the mean grouping results.&lt;/P&gt;
&lt;P&gt;Is there anyone can help me figure out the reason?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ; ** obtain p-value of trt;
	select ProbF as intP into :intP 
	from Fixedp	where Effect='Treatment';
run;

%macro lsmeansOutput (P);
  %if &amp;amp;P&amp;lt;0.05 %then %do;
    proc plm restore=&amp;amp;response.out;
	ods exclude diffplot meanplot classlevels;
        lsmeans treatment/lines;
    run;
  %end;
  %else %do;
    proc plm restore=&amp;amp;response.out;
	ods exclude diffplot meanplot classlevels;
        lsmeans treatment;
    run;    
  %end;    
%mend lsmeansOutput;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks in advance!&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 19:03:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673267#M202501</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-07-29T19:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673275#M202505</link>
      <description>Thanks for your reply! However, it doesn't work. It still only outputs the means.</description>
      <pubDate>Wed, 29 Jul 2020 19:10:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673275#M202505</guid>
      <dc:creator>RosieSAS</dc:creator>
      <dc:date>2020-07-29T19:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673284#M202512</link>
      <description>Well...what is P? Where is it created? You create a variable called IntP but I don't see a P. Is that a typo or oversight?</description>
      <pubDate>Wed, 29 Jul 2020 19:20:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673284#M202512</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-07-29T19:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673291#M202515</link>
      <description>&lt;P&gt;When I call the Macro, I used % lsmeansOutput (intP), so that should not be a problem.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 19:52:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673291#M202515</guid>
      <dc:creator>RosieSAS</dc:creator>
      <dc:date>2020-07-29T19:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673294#M202518</link>
      <description>&lt;P&gt;If you literally ran:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro lsmeansOutput (intP);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you started redefining the macro and SAS is going to take all input as part of the macro until you submit&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If instead you called the macro with intP as the input like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%lsmeansOutput (intP)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you are asking %sysevalf() to compare the letter i to the digit 0 and letter are always "larger" than digits.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure to pass the VALUE of the macro variable in the macro call.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%lsmeansOutput(&amp;amp;intP)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also make sure that your source variable&amp;nbsp;ProbF is numeric an not character.&amp;nbsp; If it is character and has a value like &amp;lt;0.001 then you are going to give %sysevalf() a very strange expression to evaluate.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 19:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673294#M202518</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-29T19:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673295#M202519</link>
      <description>&lt;P&gt;I also tried the code below, the result in Log window is "xvalue is 0, intP value is &amp;lt;.0001". Any ideas?&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let x=%sysevalf(&amp;amp;intP&amp;lt;0.05);
%put xvalue is &amp;amp;x, intP value is &amp;amp;intP;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 19:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673295#M202519</guid>
      <dc:creator>RosieSAS</dc:creator>
      <dc:date>2020-07-29T19:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673297#M202521</link>
      <description>Thanks for your reply! No matter using &amp;amp;intP or intP, the results are the same here. ProbF is a numeric, the format is pvalue6.4.</description>
      <pubDate>Wed, 29 Jul 2020 19:49:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673297#M202521</guid>
      <dc:creator>RosieSAS</dc:creator>
      <dc:date>2020-07-29T19:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673299#M202522</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;You are not going to get the less than sign into the macro from a numeric variable with the code you showed.&amp;nbsp; It does not matter what format is attached to the variable.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;correction&lt;/STRONG&gt; Actually it will put the formatted value, with leading spaces.&amp;nbsp; Remove the format or use a different format. Use the TRIMMED keyword to avoid the leading spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway IF your macro variable has values that either start with &amp;lt; or 0 then you can just eliminate the first character and it should work.&lt;/P&gt;
&lt;PRE&gt;884   %let x=&amp;lt;0.001 ;
885   %let y=0.10 ;
886   %let z=0.01 ;
887   %put &amp;amp;x -&amp;gt; %sysevalf(0.05&amp;gt;%substr(&amp;amp;x,2));
&amp;lt;0.001 -&amp;gt; 1
888   %put &amp;amp;y -&amp;gt; %sysevalf(0.05&amp;gt;%substr(&amp;amp;y,2));
0.10 -&amp;gt; 0
889   %put &amp;amp;z -&amp;gt; %sysevalf(0.05&amp;gt;%substr(&amp;amp;z,2));
0.01 -&amp;gt; 1
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 20:10:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673299#M202522</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-29T20:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673308#M202527</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/251676"&gt;@RosieSAS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks for your reply! No matter using &amp;amp;intP or intP, the results are the same here. ProbF is a numeric, the format is pvalue6.4.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;First line in my response:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;When you extract the value from the db make sure to get the raw number not the formatted value.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ; ** obtain p-value of trt;
	select ProbF format=12.5 as intP into :intP 
	from Fixedp	where Effect='Treatment';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jul 2020 21:03:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673308#M202527</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-07-29T21:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673320#M202536</link>
      <description>&lt;P&gt;Go back to where you create your INTp and fix it. You have created a character value that includes a &amp;lt; sign so the comparison fails.&lt;/P&gt;
&lt;P&gt;If a variable has an assigned format, such as pvalue6.4 when you use the Proc sql select into the default format is applied. You need to make sure that the format used doesn't place any odd characters in the result.&lt;/P&gt;
&lt;PRE&gt;data junk;
  probf = 0.00000567;
  format probf pvalue6.4;
run;
/* Wrong*/
proc sql ; ** obtain p-value of trt;
	select ProbF as intP into :intP 
	from junk;
quit;

%put IntP is: &amp;amp;intp.;
/* somewhat better*/
proc sql ; ** obtain p-value of trt;
	select ProbF format=8.6 as intP into :intP 
	from junk;
quit;

%put IntP is: &amp;amp;intp.;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you get x=0 because the comparison is false.&lt;/P&gt;
&lt;P&gt;You are evaluating %syevalf( &amp;lt;.0001&amp;lt;0.05 )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let intp = &amp;lt;.0001;
%let x=%sysevalf(&amp;amp;intP&amp;lt;0.05);
%put xvalue is &amp;amp;x, intP value is &amp;amp;intP;


%let nump = 0.0001;
%let x=%sysevalf(&amp;amp;numP&amp;lt;0.05);
%put xvalue is &amp;amp;x, NumP value is &amp;amp;numP;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 22:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673320#M202536</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-07-29T22:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673335#M202545</link>
      <description>&lt;P&gt;Thanks for all your replies!&lt;/P&gt;
&lt;P&gt;When I specify the format of intP as format12.5 or format8.6 where intP&amp;lt;.0001, the print value is 0.00000. Then I tried the following code, and the result is 1. But I don't know why it still only ran the LSMEANS without LINES part.&amp;nbsp; Below is the results from LOG window when using format8.6 in PROC SQL.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;252 %put &amp;amp;intP is intP;&lt;BR /&gt;0.000000 is intP&lt;BR /&gt;&lt;BR /&gt;253 %put %sysevalf(&amp;amp;intP&amp;lt;.05) is the logic;&lt;BR /&gt;1 is the logic&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;I tried&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;'s method using&amp;nbsp;%substr() without using FORMAT, and it works. The code is as following.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint; ** obtain p-value of trt;
	select ProbF as intP into :intP 
	from Fixedp where Effect='Treatment';
  run;

%macro lsmeansOutput(P);
   %if %sysevalf(%substr(&amp;amp;intP,2)&amp;lt;.05) %then %do;
    proc plm restore=&amp;amp;response.out;
	ods exclude diffplot meanplot classlevels;
    lsmeans treatment/lines adjust=Tukey;
    run;
   %end;
  %else %do;
    proc plm restore=&amp;amp;response.out;
	ods exclude diffplot meanplot classlevels;
    lsmeans treatment;
    run;    
  %end;    
%mend lsmeansOutput;

 %lsmeansOutput(intP);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks again for all the help! I got a lot.&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>Thu, 30 Jul 2020 00:08:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673335#M202545</guid>
      <dc:creator>RosieSAS</dc:creator>
      <dc:date>2020-07-30T00:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673338#M202547</link>
      <description>You do not need the SUBSTR(). The value may be 0.0000 and the only difference between the outputs is the lines/adjust option. If you're not sure if the %IF/%THEN statements are working, remove the code and add explicit %PUT statements to test your logic first.</description>
      <pubDate>Thu, 30 Jul 2020 00:28:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673338#M202547</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-07-30T00:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673413#M202582</link>
      <description>&lt;P&gt;Thanks for all the suggestions. I found an interesting problem that %sysevalf(&amp;amp;P&amp;lt;0.05 ) gave me different results for the same value of &amp;amp;P. The detail is, the P value is very small, after using format8.6 in proc sql, it shows 0.000000.&amp;nbsp; When I ran %put alone, the result was 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when I ran the whole %lsmansOutput(P), the result was 0. Anyone knows the reason? Thanks!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;395  %put Fail %sysevalf(&amp;amp;P&amp;lt;0.05);
Fail 1
396  %macro lsmeansOutput(P);
397     %if %sysevalf(&amp;amp;P&amp;lt;0.05) %then %do;
398      proc plm restore=&amp;amp;response.out;
399      ods exclude diffplot meanplot classlevels;
400      lsmeans treatment/lines adjust=Tukey;
401      run;
402      %put Success %sysevalf(&amp;amp;P&amp;lt;0.05);
403     %end;
404    %else %do;
405      proc plm restore=&amp;amp;response.out;
406      ods exclude diffplot meanplot classlevels;
407      lsmeans treatment;
408      run;
409      %put Fail %sysevalf(&amp;amp;P&amp;lt;0.05);
410    %end;
411  %mend lsmeansOutput;
412
413  %lsmeansOutput(P);
NOTE: PROCEDURE PLM used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


Fail 0
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I also tried simplified code, the %put also gave different results. I guess when P value is very small, or like 0.000000, the %sysevalf automatically treats P as a character variable. Please verify, thanks!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;478  %macro lsmeansOutput(P);
479    %if %sysevalf(&amp;amp;P &amp;lt;.05) %then %do;
480        %put p=&amp;amp;P;
481    %end;
482    %else %do;
483        %put met else condition=&amp;amp;P;
484    %end;
485  %mend;

486  %lsmeansOutput(P);
met else condition=P
487  %put p=&amp;amp;P;
p=0.000000
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:25:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673413#M202582</guid>
      <dc:creator>RosieSAS</dc:creator>
      <dc:date>2020-07-30T13:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673419#M202583</link>
      <description>&lt;P&gt;You use the literal string P instead of the macro variable reference &amp;amp;P when calling the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the macro reference, the code works:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let p=0.00000000001;

%put Fail %sysevalf(&amp;amp;P&amp;lt;0.05);

%macro lsmeansOutput(P);
   %if %sysevalf(&amp;amp;P&amp;lt;0.05) %then %do;
     %put Yes branch;
   %end;
  %else %do;
    %put No branch;
  %end;
%mend lsmeansOutput;

%lsmeansOutput(&amp;amp;P);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:21:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673419#M202583</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-30T13:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673421#M202584</link>
      <description>&lt;P&gt;&lt;STRONG&gt;You are calling the macro with just the letter P as the value&lt;/STRONG&gt;, not the value of the macro variable P that you tested before you defined the macro and called.&amp;nbsp; &amp;nbsp;Add the value of the local macro variable P to your %PUT statements inside your macro definition so you can see what you actually tested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The letter P is NOT less than the digit 0.&amp;nbsp; Howver if you have told SAS to treat P when reading text into numbers as meaning special missing value .P by including it in the list of letters used in a&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=lestmtsglobal&amp;amp;docsetTarget=n0ewjmosjtyjbtn1t5zabfkrof4f.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;MISSING statement&lt;/A&gt; then the test will find that P is &amp;lt; 0.05 since it will actually test if .P &amp;lt; 0.05 instead and all missing values are less than all actual numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 13:23:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673421#M202584</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-30T13:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673435#M202587</link>
      <description>&lt;P&gt;Thanks for all your inputs, without your helps, I couldn't figure it out. Here it the code to solve my problem.&lt;/P&gt;
&lt;P&gt;Using %lsmeansOutput(&amp;amp;P) instead of %lsmeansOutput(P) in when calling this macro function after format P to FORMAT 12.5.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ; ** obtain p-value of trt;
	select ProbF format 12.5 as P into :P 
	from Fixedp	where Effect='Treatment';
  run;

%macro lsmeansOutput(P);
   %if %sysevalf(&amp;amp;P&amp;lt;.05) %then %do;
    proc plm restore=&amp;amp;response.out;
      lsmeans treatment/lines adjust=Tukey;
    run;
	%put Yes branch;
   %end;
  %else %do;
    proc plm restore=&amp;amp;response.out;
      lsmeans treatment;
    run;    
	%put No branch;
  %end;    
%mend lsmeansOutput;
  %lsmeansOutput(&amp;amp;P);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 14:19:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673435#M202587</guid>
      <dc:creator>RosieSAS</dc:creator>
      <dc:date>2020-07-30T14:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673441#M202589</link>
      <description>&lt;P&gt;Your second example provides the expected result while being completely wrong &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You take the substring of a string with the length of 1 ("P"), starting at position 2; this results in an empty value, which is of course smaller than anything else.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 14:05:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673441#M202589</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-30T14:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673444#M202590</link>
      <description>&lt;P&gt;The last call&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;%lsmeansOutput(P)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;cannot work.&lt;/P&gt;
&lt;P&gt;You have passed the letter P to the macro.&amp;nbsp; If you macro expected the NAME of a macro variable that might work, but even that could not work in this case since the global macro variable has the same name as the local macro variable (the parameters listed in the %macro statement are local macro variables).&amp;nbsp; Inside the macro the local macro variables will hide any macro variables with the same name in any outer scope.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 14:08:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673444#M202590</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-30T14:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673446#M202592</link>
      <description>Your inference makes sense, but when p&amp;gt;0.05, it did run the %else condition without grouping results. I don't know how that happened. Do you mean &amp;amp;y should be used instead of y for every macro function %function(y)?</description>
      <pubDate>Thu, 30 Jul 2020 14:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673446#M202592</guid>
      <dc:creator>RosieSAS</dc:creator>
      <dc:date>2020-07-30T14:11:16Z</dc:date>
    </item>
  </channel>
</rss>

