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 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 3 Oct 2007 07:18:32 -0400
Reply-To:     Jim Groeneveld <jim4stat@YAHOO.CO.UK>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jim Groeneveld <jim4stat@YAHOO.CO.UK>
Subject:      Re: proc print output in case of 0 observation
Comments: To: jainankur@GMAIL.COM

Hi Ankur,

No, there is no possibility to do this just with PROC PRINT or another PROC. It has been discussed quite several times here at SAS-L.

The only option is to add some program code yourself: Firstly determine the number of observations in a dataset:

DATA _NULL_; IF 0 THEN SET <<YourData>> NOBS=NofCases; CALL SYMPUT('NofCases',COMPRESS(PUT(NofCases,8.))); STOP; RUN;

(There may be more methods to do this.) Then you have a macro variable &NofCases containing the number of observations in the dataset. Subsequently from within a macro you can macro-conditionally do a PROC PRINT if &NofCases > 0 or something else if &NofCases = 0. Personally I do:

DATA NoData; Message = "Empty dataset <<data set name>>, no table."; PUT Message=; * for log file; RUN; PROC REPORT DATA=NoData; RUN;

Regards - Jim. -- Jim Groeneveld, Netherlands Statistician, SAS consultant home.hccnet.nl/jim.groeneveld

On Wed, 3 Oct 2007 03:59:43 -0700, Ankur <jainankur@GMAIL.COM> wrote:

>Hi > >I have a dataset that I am trying to display using proc print. Since, >the dataset doesn't have any observation, proc print doesn't print >anything, not even the column headers. Could anyone explain how to use >proc print or any other method of displaying the column headers as the >output. > >Say, dataset is test_dt; >+-------------+------------+ >column_a +column_b >+-------------+------------+ >+ + + >+-------------+------------+ > >I want to display the headers as the output. > >------------------------------ >column_a+column_b >------------------------------ > >Could someone provide some help? > > >Regards >Ankur Jain > >http://ankurjain.org


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