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 12:42:22 -0600
Reply-To:   "Data _null_;" <iebupdte@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Data _null_;" <iebupdte@GMAIL.COM>
Subject:   Re: Display no observations
Comments:   To: sas quest <sasquest@gmail.com>
In-Reply-To:   <CAEZCysuaB8K0XU4ZWG9cs+2E9F-Bk7Gk2wPMO9kNA7nPW1LX7g@mail.gmail.com>
Content-Type:   text/plain; charset=ISO-8859-1

Hello! Did you even look at my program? It believe it does exactly what you asked. If there are 0 obs asign a value to an unknown character variable.

Here is a modification that assigns No OBS to all the character variables.

data heart; stop; set sashelp.heart; run; data heart; if 0 then modify heart end=eof; array _c[*] _character_; if eof and _n_ eq 1 then do; do _n_ = 1 to dim(_c); _c[_n_] = 'No observations'; end; output; end; stop; run; proc print data=heart; run;

On 2/24/12, Data _null_; <iebupdte@gmail.com> wrote: > This should work with or without macro. Notice the first character > variables will recieve the message text. If it is too short as in > this example it will be truncated. > > data class; > stop; > set sashelp.class; > run; > data class; > if 0 then modify class end=eof; > array _c[*] _character_; > if eof and _n_ eq 1 then do; > _c[1] = 'No observations'; > output; > end; > stop; > run; > proc print data=class; > run; > > On 2/24/12, sas quest <sasquest@gmail.com> wrote: >> 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 >> >


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