<?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 Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673290#M32220</link>
    <description>Thanks for your reply! I just tried, however, I still only got means when p&amp;lt;.0001.</description>
    <pubDate>Wed, 29 Jul 2020 19:29:44 GMT</pubDate>
    <dc:creator>RosieSAS</dc:creator>
    <dc:date>2020-07-29T19:29:44Z</dc:date>
    <item>
      <title>How to express the p value when &lt;.0001 in %IF statement.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673266#M32218</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;I also posted the problem in Programming forum, but not sure where is more appropriate, programming problem or statistical analysis problem. Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 18:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673266#M32218</guid>
      <dc:creator>RosieSAS</dc:creator>
      <dc:date>2020-07-29T18:59: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/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673287#M32219</link>
      <description>&lt;P&gt;Macro language does not treat decimal points as numeric.&amp;nbsp; You would need to change this line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if &amp;amp;P&amp;lt;0.05 %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Instead, code it as:&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;</description>
      <pubDate>Wed, 29 Jul 2020 19:24:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673287#M32219</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-07-29T19:24: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/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673290#M32220</link>
      <description>Thanks for your reply! I just tried, however, I still only got means when p&amp;lt;.0001.</description>
      <pubDate>Wed, 29 Jul 2020 19:29:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673290#M32220</guid>
      <dc:creator>RosieSAS</dc:creator>
      <dc:date>2020-07-29T19:29:44Z</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/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673313#M32221</link>
      <description>&lt;P&gt;You need to show exactly how you are calling your macro LsmeansOutput. As in the code.&lt;/P&gt;
&lt;P&gt;Since P is a parameter passed to the macro how it is passed is important.&lt;/P&gt;
&lt;P&gt;And since you are using the same name for the data set&amp;nbsp; &amp;amp;Response.out are you actually using a different data set? Not showing where macro values come from is a common problem with debugging macros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of the common tools is to set Options Mprint Mlogic Symbolgen; before running the macro to see the code generated, macro logic (the %if ) resolution and the values of macro variables as built, such as &amp;amp;Response.out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 21:23:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673313#M32221</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-07-29T21:23:37Z</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/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673344#M32223</link>
      <description>&lt;P&gt;You have the proc sql code that creates a variable called intP, but the code below references macro variable P.&amp;nbsp; There is no value set in macro variable P.&amp;nbsp; Is it your intention to pass the value from proc sql to the next step below?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To start troubleshooting your macro, you do want to turn on the SAS options mentioned by another user.&amp;nbsp; You can also use put statements to write messages to the log. I suspect that you are passing P&amp;lt;.0001 as a character value which then never meets this condition. The top argument in the sample code below is a brute force workaround adding P&amp;lt;.0001 as a possible if-then condition. &lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro lsmeansOutput(p);
  %if %sysevalf(&amp;amp;p = &amp;lt;.0001) %then %do;
      %put p=&amp;amp;p;
  %end; 
  %else %if %sysevalf(&amp;amp;p&amp;lt;0.05) %then %do;
      %put p=&amp;amp;p; 
  %end;
  %else %do;
      %put met else condition=&amp;amp;p; 
  %end;
%mend; 
%lsmeansOutput(p=.01); 
%lsmeansOutput(p=.05); 
%lsmeansOutput(p=.0001);  
%lsmeansOutput(p=&amp;lt;.0001); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 03:20:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673344#M32223</guid>
      <dc:creator>Nicole_Fox</dc:creator>
      <dc:date>2020-07-30T03:20: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/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673455#M32227</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 class="language-sas"&gt;&lt;CODE&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:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-express-the-p-value-when-lt-0001-in-IF-statement/m-p/673455#M32227</guid>
      <dc:creator>RosieSAS</dc:creator>
      <dc:date>2020-07-30T14:21:07Z</dc:date>
    </item>
  </channel>
</rss>

