<?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: check table results into report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/check-table-results-into-report/m-p/564971#M158527</link>
    <description>&lt;P&gt;in case someone needs it, here is the final code that i settled on from the help of others and my searching for code...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;options orientation=landscape;
options label nodate pageno=1;

ods escapechar='^';
ods pdf file=”RPT.pdf" startpage=no;


Title height=14pt underlin=1 'Reporting - Report';
Footnote Generated by &amp;amp;_CLIENTUSERNAME with SAS Enterprise Guide &amp;amp;_CLIENTVERSION;

ods pdf text = "^{style [just=center font=(Arial) fontsize=12pt fontweight=bold 
		color=black] Sub-Title}";

%macro tblchk;
data _null_;
%let dsid=%sysfunc(open(TABLE01));
%let nobs=%sysfunc(attrn(&amp;amp;dsid,nlobs));
%let dsid=%sysfunc(close(&amp;amp;dsid));

%if &amp;amp;nobs=0 %then %do;
proc odstext;
p 'There are NO Results!' / style=[color=red just=c fontsize=10pt fontweight=bold];
%end;

%else %do;
proc sql;
select *
from TABLE01;
quit;
%end;

%mend tblchk;
run;

%tblchk;
run;

&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the help as usual...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jun 2019 17:21:13 GMT</pubDate>
    <dc:creator>me55</dc:creator>
    <dc:date>2019-06-10T17:21:13Z</dc:date>
    <item>
      <title>check table results into report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-table-results-into-report/m-p/563585#M158020</link>
      <description>&lt;P&gt;okay, i have a pdf report i am trying to build.&amp;nbsp; it is...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options orientation=landscape;&lt;BR /&gt;ods pdf file="RTP03.pdf";&lt;/P&gt;&lt;P&gt;Title 'title 01';&lt;BR /&gt;Footnote Generated by &amp;amp;_CLIENTUSERNAME with SAS Enterprise Guide &amp;amp;_CLIENTVERSION;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select ...&lt;BR /&gt;from TEST01;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;title;&lt;BR /&gt;footnote;&lt;/P&gt;&lt;P&gt;ods pdf close;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what i want it to do is to replace the sql pull into a macros that will check if a table (TEST01) has results in it that will be added from a insert into query.&amp;nbsp; if there are not results, put a line like 'there are no results' on the pdf and if the table has results, pull the data and put that on the pdf.&amp;nbsp; i have a macro set but i just cant finish it off yet.&amp;nbsp; i am just not knowledgeable enough in sas macros to finish this off...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro tblchk;&lt;/P&gt;&lt;P&gt;%let dsid=%sysfunc(open(TEST01));&lt;BR /&gt;%let nobs=%sysfunc(attrn(&amp;amp;dsid,nlobs));&lt;BR /&gt;%let dsid=%sysfunc(close(&amp;amp;dsid));&lt;/P&gt;&lt;P&gt;%if &amp;amp;nobs=0 %then %do;&lt;BR /&gt;%put There are no issues;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%else %do;&lt;BR /&gt;proc sql;&lt;BR /&gt;select *&lt;BR /&gt;from TEST01;&lt;BR /&gt;quit;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%mend tblchk;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;something is just off here...i am just not sure what.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 18:28:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-table-results-into-report/m-p/563585#M158020</guid>
      <dc:creator>me55</dc:creator>
      <dc:date>2019-06-04T18:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: check table results into report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-table-results-into-report/m-p/563586#M158021</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro tblchk;
data _null_;
%let dsid=%sysfunc(open(TEST01));
%let nobs=%sysfunc(attrn(&amp;amp;dsid,nlobs));
%let dsid=%sysfunc(close(&amp;amp;dsid));
%if &amp;amp;nobs=0 %then %do;
%put There are no issues;
%end;
%else %do;
proc sql;
select *
from TEST01;
quit;
%end;
run;
%mend tblchk;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;put a data null in the macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 18:46:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-table-results-into-report/m-p/563586#M158021</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-06-04T18:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: check table results into report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-table-results-into-report/m-p/563590#M158023</link>
      <description>&lt;P&gt;yeah, that is not working.&amp;nbsp; i should be able to replace the above sql in the report with the macro and have it either say there are no results or pull the results and that is not happening when i simply put the data _null_; in there...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 19:14:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-table-results-into-report/m-p/563590#M158023</guid>
      <dc:creator>me55</dc:creator>
      <dc:date>2019-06-04T19:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: check table results into report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-table-results-into-report/m-p/563592#M158024</link>
      <description>&lt;P&gt;Instead of&lt;/P&gt;
&lt;PRE&gt;%if &amp;amp;nobs=0 %then %do;
%put There are no issues;
%end;&lt;/PRE&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;%if &amp;amp;nobs=0 %then %do;
Proc odstext;
p "There are no results";
run;
%end;&lt;/PRE&gt;
&lt;P&gt;%put writes to the log&lt;/P&gt;
&lt;P&gt;Put can write to the log or a file but you will need to a bit more to create ODS output.&lt;/P&gt;
&lt;P&gt;Simpler is to use a Proc designed to create ODS output.&lt;/P&gt;
&lt;P&gt;If you want to make the text prettier you can add style elements to the P statements in Proc Odstext.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 19:26:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-table-results-into-report/m-p/563592#M158024</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-04T19:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: check table results into report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/check-table-results-into-report/m-p/564971#M158527</link>
      <description>&lt;P&gt;in case someone needs it, here is the final code that i settled on from the help of others and my searching for code...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;options orientation=landscape;
options label nodate pageno=1;

ods escapechar='^';
ods pdf file=”RPT.pdf" startpage=no;


Title height=14pt underlin=1 'Reporting - Report';
Footnote Generated by &amp;amp;_CLIENTUSERNAME with SAS Enterprise Guide &amp;amp;_CLIENTVERSION;

ods pdf text = "^{style [just=center font=(Arial) fontsize=12pt fontweight=bold 
		color=black] Sub-Title}";

%macro tblchk;
data _null_;
%let dsid=%sysfunc(open(TABLE01));
%let nobs=%sysfunc(attrn(&amp;amp;dsid,nlobs));
%let dsid=%sysfunc(close(&amp;amp;dsid));

%if &amp;amp;nobs=0 %then %do;
proc odstext;
p 'There are NO Results!' / style=[color=red just=c fontsize=10pt fontweight=bold];
%end;

%else %do;
proc sql;
select *
from TABLE01;
quit;
%end;

%mend tblchk;
run;

%tblchk;
run;

&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the help as usual...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 17:21:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/check-table-results-into-report/m-p/564971#M158527</guid>
      <dc:creator>me55</dc:creator>
      <dc:date>2019-06-10T17:21:13Z</dc:date>
    </item>
  </channel>
</rss>

