LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 7 May 2009 17:40:44 -0400
Reply-To:   Joe Whitehurst <joewhitehurst@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Joe Whitehurst <joewhitehurst@GMAIL.COM>
Subject:   Re: Error message to pdf file.
Comments:   To: "Data _null_," <iebupdte@gmail.com>
In-Reply-To:   <ce1fb7450905071420g7a9cd0d8r392aadf3bae0c85@mail.gmail.com>
Content-Type:   text/plain; charset=ISO-8859-1

For a more general (and more generalizable) solution, you can simply use a put statement in a datastep. You don't need the extra pass of the data required by a PROC: SyntaxPUT <specification><_ODS_><@|@@>;

Note:

This syntax shows only the ODS form of the PUT statement when you are binding to a template. For the complete syntax, see thePUT statement<http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000161869.htm> in SAS Language Reference: Dictionary. [image: [cautionend]]

On Thu, May 7, 2009 at 5:20 PM, Data _null_; <iebupdte@gmail.com> wrote:

> This is one scenario for to check for 0 records. > > data apple; > stop; *remove to test; > length message $50; > do defect = 1 to 10; > message = 'This is a defective part'; > output; > end; > run; > data apple; > if _n_ eq 1 and eof then do; > message = 'There are no defects to report'; > output; > end; > stop; > modify apple end=eof; > run; > proc print data=apple; > run; > > On 5/7/09, Data _null_; <iebupdte@gmail.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 <brian_c_wallace@yahoo.com> 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 > > > > > >


Back to: Top of message | Previous page | Main SAS-L page