<?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: proselyte needs help with conditional printing. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25763#M5857</link>
    <description>Data XyZ ;&lt;BR /&gt;
Input ID $ tot cost;&lt;BR /&gt;
cards;&lt;BR /&gt;
ABC 10 100&lt;BR /&gt;
XYZ 20 200&lt;BR /&gt;
;&lt;BR /&gt;
RUN;&lt;BR /&gt;
Data ABC ;&lt;BR /&gt;
Input ID $ tot cost;&lt;BR /&gt;
cards;&lt;BR /&gt;
ABC 0 0&lt;BR /&gt;
XYZ 0 0&lt;BR /&gt;
;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
%Macro A(dsn) ;&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
select sum(tot) into : totsum from &amp;amp;dsn;   &lt;BR /&gt;
quit;&lt;BR /&gt;
%if  (&amp;amp;totsum) &amp;gt; 0 %then %do;&lt;BR /&gt;
proc print data = &amp;amp;dsn ;run;&lt;BR /&gt;
%end ;&lt;BR /&gt;
%else %do ;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
file print notitle ls=80;;&lt;BR /&gt;
Put @50 "Data Set &amp;amp;DSN has zero Total Cost.";&lt;BR /&gt;
Run;&lt;BR /&gt;
%end;&lt;BR /&gt;
%Mend A;&lt;BR /&gt;
%A(xyz) ;&lt;BR /&gt;
%A(ABC) ;</description>
    <pubDate>Tue, 05 May 2009 22:45:44 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-05-05T22:45:44Z</dc:date>
    <item>
      <title>proselyte needs help with conditional printing.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25758#M5852</link>
      <description>I only want proc print  to create a print report if a  sum amount from the data step is greater than zero. &lt;BR /&gt;
&lt;BR /&gt;
The customer doesn't want the report created if the fields on the report are all zeros.  &lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Thu, 30 Apr 2009 13:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25758#M5852</guid>
      <dc:creator>jberkes</dc:creator>
      <dc:date>2009-04-30T13:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: proselyte needs help with conditional printing.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25759#M5853</link>
      <description>Without using macro language, you can execute a DATA that determines your "print" or "no print" condition, then use SAS CALL EXECUTE to dynamically generate the PROC PRINT which would be executed after the DATA step completes.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 30 Apr 2009 16:58:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25759#M5853</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-30T16:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: proselyte needs help with conditional printing.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25760#M5854</link>
      <description>I understand the concept of Scott's explanation but I don't know the syntax for implementing it.&lt;BR /&gt;
&lt;BR /&gt;
Can someone fix up this code to not print when the Total is 0?  &lt;BR /&gt;
&lt;BR /&gt;
Data A;&lt;BR /&gt;
Input YEAR SALES COST;&lt;BR /&gt;
RETAIN Total 0;&lt;BR /&gt;
Total = SUM(Total, SALES);&lt;BR /&gt;
&lt;BR /&gt;
CARDS;&lt;BR /&gt;
2009  0 0&lt;BR /&gt;
2009  0 0 &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
PROC PRINT DATA=A;&lt;BR /&gt;
&lt;BR /&gt;
Your help would be greatly appreciated.   &lt;BR /&gt;
Thanks&lt;BR /&gt;
Jim Berkes</description>
      <pubDate>Thu, 30 Apr 2009 20:58:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25760#M5854</guid>
      <dc:creator>jberkes</dc:creator>
      <dc:date>2009-04-30T20:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: proselyte needs help with conditional printing.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25761#M5855</link>
      <description>Your PROC PRINT code would need to be contained in a SAS variable (one option), and then if you find an unsuitable condition, do not invoke the CALL EXECUTE statement.&lt;BR /&gt;
&lt;BR /&gt;
The SAS support website  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  has several topic-related papers for example code and conceptual reference, as well as a SAS-hosted documentation.  Or consider the Google advanced search argument below which reveals several search-matches on the topic:&lt;BR /&gt;
&lt;BR /&gt;
call execute site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 30 Apr 2009 22:00:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25761#M5855</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-30T22:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: proselyte needs help with conditional printing.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25762#M5856</link>
      <description>Thanks for your help Scott.&lt;BR /&gt;
&lt;BR /&gt;
I found what I needed using your seach suggestions.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Jim</description>
      <pubDate>Fri, 01 May 2009 13:19:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25762#M5856</guid>
      <dc:creator>jberkes</dc:creator>
      <dc:date>2009-05-01T13:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: proselyte needs help with conditional printing.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25763#M5857</link>
      <description>Data XyZ ;&lt;BR /&gt;
Input ID $ tot cost;&lt;BR /&gt;
cards;&lt;BR /&gt;
ABC 10 100&lt;BR /&gt;
XYZ 20 200&lt;BR /&gt;
;&lt;BR /&gt;
RUN;&lt;BR /&gt;
Data ABC ;&lt;BR /&gt;
Input ID $ tot cost;&lt;BR /&gt;
cards;&lt;BR /&gt;
ABC 0 0&lt;BR /&gt;
XYZ 0 0&lt;BR /&gt;
;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
%Macro A(dsn) ;&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
select sum(tot) into : totsum from &amp;amp;dsn;   &lt;BR /&gt;
quit;&lt;BR /&gt;
%if  (&amp;amp;totsum) &amp;gt; 0 %then %do;&lt;BR /&gt;
proc print data = &amp;amp;dsn ;run;&lt;BR /&gt;
%end ;&lt;BR /&gt;
%else %do ;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
file print notitle ls=80;;&lt;BR /&gt;
Put @50 "Data Set &amp;amp;DSN has zero Total Cost.";&lt;BR /&gt;
Run;&lt;BR /&gt;
%end;&lt;BR /&gt;
%Mend A;&lt;BR /&gt;
%A(xyz) ;&lt;BR /&gt;
%A(ABC) ;</description>
      <pubDate>Tue, 05 May 2009 22:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proselyte-needs-help-with-conditional-printing/m-p/25763#M5857</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-05-05T22:45:44Z</dc:date>
    </item>
  </channel>
</rss>

