Date: Sun, 24 Aug 2008 18:20:07 -0700
Reply-To: Patrick <patrick.matter@GMX.CH>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Patrick <patrick.matter@GMX.CH>
Organization: http://groups.google.com
Subject: Re: Conditional Reporting (one for data and Other Empty data set
Content-Type: text/plain; charset=ISO-8859-1
Hi SAS_learner
You could do something like in the code below.
Even if there should be a possibility I don't think you should try to
pack everything into a single PROC REPORT without any macro coding
because: The syntax would become quite complicated and a little change
in the requirements could mean a huge change for coding.
HTH
Patrick
data have;
msg='No Data to Report';
do vara=1 to 10;
varb=ranuni(0);
output;
end;
run;
%macro report(ds=,clause=);
%local report;
%let report=0;
data report;
set have;
if &clause;
call symput('report','1');
stop;
run;
proc print data=have;
%if &report=1 %then
%do;
where &clause;
var vara varb;
%end;
%else
%do;
where vara=1;
var msg;
%end;
run;
%mend;
title1 'clause=vara>5';
%report(ds=have,clause=vara>5)
title1 'clause=vara>15';
%report(ds=have,clause=vara>15)