<?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: Macro if then print in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-if-then-print/m-p/438599#M109378</link>
    <description>&lt;P&gt;And did you try my code as that is what it does, or do you need to put the words macro in there?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;%macro for_macros_sake (p=);

proc sort data=work.superstore;
  by descending profit;
  where profit &amp;gt;= &amp;amp;p.;
run;&lt;BR /&gt;title "Profit";
proc print data=work.superstore;
run;&lt;BR /&gt;&lt;BR /&gt;%mend for_macros_sake;&lt;BR /&gt;&lt;BR /&gt;%for_macros_sake (p=500);&lt;/PRE&gt;</description>
    <pubDate>Tue, 20 Feb 2018 11:22:15 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-02-20T11:22:15Z</dc:date>
    <item>
      <title>Macro if then print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-if-then-print/m-p/438590#M109372</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro con (p=);
proc sort data=work.superstore;
by descending profit;
%if profit ge &amp;amp;p %then %do;
title 'Profit';
proc print data=work.superstore;
%end;
%mend;
run;

%con (p=500);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to print the data if the condition is met in the profit variable but the result i am getting is the entire table.&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 445px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18693iFC90A184FF6D4226/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 10:10:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-if-then-print/m-p/438590#M109372</guid>
      <dc:creator>pritish069</dc:creator>
      <dc:date>2018-02-20T10:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro if then print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-if-then-print/m-p/438591#M109373</link>
      <description>&lt;P&gt;So you want to only print data where profit is the given value correct?&lt;/P&gt;
&lt;P&gt;If so:&lt;/P&gt;
&lt;PRE&gt;%let p=500;

proc sort data=work.superstore;
  by descending profit;
  where profit &amp;gt;= &amp;amp;p.;
run;&lt;BR /&gt;title "Profit";
proc print data=work.superstore;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Feb 2018 10:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-if-then-print/m-p/438591#M109373</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-20T10:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Macro if then print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-if-then-print/m-p/438597#M109376</link>
      <description>I want the macro to sort and print where the profit is the given value</description>
      <pubDate>Tue, 20 Feb 2018 11:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-if-then-print/m-p/438597#M109376</guid>
      <dc:creator>pritish069</dc:creator>
      <dc:date>2018-02-20T11:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Macro if then print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-if-then-print/m-p/438599#M109378</link>
      <description>&lt;P&gt;And did you try my code as that is what it does, or do you need to put the words macro in there?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;%macro for_macros_sake (p=);

proc sort data=work.superstore;
  by descending profit;
  where profit &amp;gt;= &amp;amp;p.;
run;&lt;BR /&gt;title "Profit";
proc print data=work.superstore;
run;&lt;BR /&gt;&lt;BR /&gt;%mend for_macros_sake;&lt;BR /&gt;&lt;BR /&gt;%for_macros_sake (p=500);&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Feb 2018 11:22:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-if-then-print/m-p/438599#M109378</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-02-20T11:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Macro if then print</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-if-then-print/m-p/438600#M109379</link>
      <description>Thankyou!</description>
      <pubDate>Tue, 20 Feb 2018 11:25:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-if-then-print/m-p/438600#M109379</guid>
      <dc:creator>pritish069</dc:creator>
      <dc:date>2018-02-20T11:25:44Z</dc:date>
    </item>
  </channel>
</rss>

