|Date: ||Thu, 7 May 2009 16:20:07 -0500|
|Reply-To: ||"Data _null_;" <iebupdte@GMAIL.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||"Data _null_;" <iebupdte@GMAIL.COM>|
|Subject: ||Re: Error message to pdf file.|
|Content-Type: ||text/plain; charset=ISO-8859-1|
This is one scenario for to check for 0 records.
stop; *remove to test;
length message $50;
do defect = 1 to 10;
message = 'This is a defective part';
if _n_ eq 1 and eof then do;
message = 'There are no defects to report';
modify apple end=eof;
proc print data=apple;
On 5/7/09, Data _null_; <email@example.com> wrote:
> You need to use ODS PDF to create a PDF of a PROC PRINT of APPLE, perhaps.
> If APPLE has 0 records you need to ADD one with the message before you
> PROC PRINT to ODS PDF. You can find examples of using the SET or
> MODIFY statement option END= to detect end of file when _N_ eq 1
> before you execute the SET or MODIFY.
> On 5/7/09, Brian Wallace <firstname.lastname@example.org> wrote:
> > I'm a little disgusted with myself for not being able to come up with a solution for this immediately. I honestly wouldn't want an explicit solution. More like advice on strategy.
> > I have a data set. Let's call it APPLE. Either APPLE contains "defective" records that I want to output to a pdf OR it contains no records. If it contain no problematic records, I want the pdf to contain a message "There were no problematic records."
> > Psuedo code:
> > DATA _NULL_;
> > SET APPLE NOBS = CNT;
> > FILE 'C:\SAS\check.pdf';
> > IF CNT = 0 THEN PUT 'There were no problematic records.';
> > ELSE OUTPUT;
> > RUN;
> > I think I'm going to need a couple macros, maybe. I don't know. Any help would be appreciated but (and I know this is looking a gift horse in the mouth) I'd appreciate suggestions, not solutions. I have to come up with this on my own. I'm tired of using the SAS-L as a crutch.
> > Thank you,
> > Brian Wallace