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 (February 2012, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 24 Feb 2012 10:53:22 -0500
Reply-To:   sas quest <sasquest@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   sas quest <sasquest@GMAIL.COM>
Subject:   Re: Display no observations
In-Reply-To:   <FA0550A1D186FF49BB0748CD711B17EDEF31D40756@SDPSMSX.QUALNET.ORG>
Content-Type:   text/plain; charset=ISO-8859-1

Hi,

Right now i am using the following code which is inside a macro which runs for multiple datasets.

data _DSN2; if 0 then set _DSN1 nobs=nobs; if nobs=0 then do; call symput("nobs", "0"); &psid="&sub"; visn="NO DATA "; output; end; run;

The above helps me display "NO DATA" in my output report because i know that the data which has no observations has a variable called "visn".

When i run this on another study where another data say, DEATH has no observations, in the report "visn" doesnt exist. Variables like dthdt,dtdiscon,dthrsn..are there.

So when i run the above code my report just has blank values under these variables. I want to put "NO DATA" under first variable DTHDT. so the program should create a macro variable which stores the first variable name in the datasets. I can then just say &var="No DATA"

I hope iam clear.

Thanks,

On 2/24/12, Bian, Haikuo <HBian@flqio.sdps.org> wrote: > Not sure what exactly you are asking for, the following code will get you a > macro variable 'var' with value of 'No observations' if the dataset is > empty. > > > data abc; > set xyz nobs=nobs; > if nobs=0 then call symput ('var','No observations'); > run; > > %put &var; > > > Regards, > Haikuo > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of sas > quest > Sent: Friday, February 24, 2012 9:58 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Display no observations > > Hi, > > I want to assign a value to a variable as "No observations" from an > empty dataset that changes its variables each time it is run. The > dataset is inside a complex macro. > > I know many ways to create it and display it but inside the macro i > find it difficult................ > > i need something like this: > > data abc; > set xyz; > > /*code needed here to create var*/ > > &var="No observations"; > run; > > The above macro variable "var" should be chosen from the datset xyz > which changes its variable names dynamically. > > > Thanks in advance > ----------------------------------------- > Email messages cannot be guaranteed to be secure or error-free as > transmitted information can be intercepted, corrupted, lost, > destroyed, arrive late or incomplete, or contain viruses. The > Centers for Medicare & Medicaid Services therefore does not accept > liability for any error or omissions in the contents of this > message, which arise as a result of email transmission. > > CONFIDENTIALITY NOTICE: This communication, including any > attachments, may contain confidential information and is intended > only for the individual or entity to which it is addressed. Any > review, dissemination, or copying of this communication by anyone > other than the intended recipient is strictly prohibited. If you > are not the intended recipient, please contact the sender by reply > email and delete and destroy all copies of the original message. >


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