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 (October 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 18 Oct 2004 16:49:42 -0400
Reply-To:   Sigurd Hermansen <HERMANS1@WESTAT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Sigurd Hermansen <HERMANS1@WESTAT.COM>
Subject:   Re: Create Output Identifying No Records Found
Comments:   To: "Michael F. Murphy" <Michael.F.Murphy@KP.ORG>
Content-Type:   text/plain

Michael: As an alternative to other, more global solutions, take a look at this simple method: data noPrint; message='nada'; run; data test; x=12; run; proc sql; create table print as select * from test where x<=12 ; quit; proc sql noprint; select count(*) into :__n from print ; quit; %macro testPrint(___n); %if (&___n ne 0) %then %do; proc print data=print; run; quit; %end; %else %do; proc print data=noprint noobs; run; quit; %end; %mend testPrint; %testPrint(&__n) **;

Since the SELECT INTO clause instantiates the macrovariable __n, the test of the macrovariable value follows creation of the dataset named 'print'. Sig -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Michael F. Murphy Sent: Monday, October 18, 2004 2:26 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Create Output Identifying No Records Found

Hi SAS-L-ers,

We have a program that creates a SAS dataset, called "COSTS", that contains data from different sources for one health record number. This is printed to a LST file.

If no records are found, no LST file is created. If this is the case, we want the user to know that no records were found when they go to the LST file. Otherwise the LST file contains the relevant cost data.

What SAS code will do this?

Thanks.

Mike


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