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:         Fri, 1 May 2009 16:08:51 -0500
Reply-To:     Joe Matise <snoopy369@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Joe Matise <snoopy369@GMAIL.COM>
Subject:      Re: Boolean Condition for a series of variables
Comments: To: Scott Murff <sdmurff@gmail.com>
In-Reply-To:  <200905012046.n41H1njB023787@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1

You need the OF operator, and the MISSING function; however you cannot really do exactly what you want there, as (at least in my tests) IF MISSING(OF X1-X5) does not work.

You can use the following example:

data test; call missing(of x1-x5); x1=5; x2=4; x3=3; x4=2; run; data want; set test; if missing(sum(of x1-x5)) then xm_all=1; if nmiss(of x1-x5) > 0 then xm_any = 1; put _all_; run;

The nmiss line is probably what you want.

-Joe On Fri, May 1, 2009 at 3:46 PM, Scott Murff <sdmurff@gmail.com> wrote:

> Hi, > > Is it possible to use conditional logic on a series of variables? For > example I have a series of variables with names fcfe1, fcfe2, ..., fcfe20. > I want to conditionally execute statements if all of these variables are > non-missing. > > I thought something like this would work. > > if fcfe1-fcfe20 ne . then do; > > sas statements; > > end; > > In this context SAS interprets fcfe1-fcfe20 as subtraction instead of a > series of var names. I am looking for a short cut from having to list out > all 20 variable names. > > Thanks. >


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