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 (August 2007, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 31 Aug 2007 09:37:33 -0700
Reply-To:   "ajs2004@bigfoot.com" <ajs2004@BIGFOOT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "ajs2004@bigfoot.com" <ajs2004@BIGFOOT.COM>
Organization:   http://groups.google.com
Subject:   Re: derive variable for dataset (urgent)
Comments:   To: sas-l@uga.edu
In-Reply-To:   <1188577703.372626.128960@d55g2000hsg.googlegroups.com>
Content-Type:   text/plain; charset="us-ascii"

It's pretty flexible with variable lists. You can do things like:

mean(of x1-x4, of x22-x24, x50, x99);

see also http://support.sas.com/onlinedoc/913/getDoc/en/lrcon.hlp/a000695105.htm

On Aug 31, 5:28 pm, sas...@gmail.com wrote: > On Aug 31, 11:39 am, Bob_Abel...@HGSI.COM wrote: > > > > > > > Dear , > > > This is untested, but I think it's what you want. > > > data need; > > set have; > > if nmiss(of x1-x16)<=4 then newvar = 4*sum(of x1-x16)/n(of > > x1-x16); > > run; > > > Bob Abelson > > HGSI > > 240 314 4400 x1374 > > bob_abel...@hgsi.com > > > sas...@GMAIL.COM > > Sent by: "SAS(r) Discussion" <SA...@LISTSERV.UGA.EDU> > > 08/31/2007 11:27 AM > > Please respond to > > sas...@GMAIL.COM > > > To > > SA...@LISTSERV.UGA.EDU > > cc > > > Subject > > derive variable for dataset (urgent) > > > Dear all, > > > i have variable like > > This are the name of the variable from x1 - x16. > > x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 > > > Now what i want to do first is i want to check if there are 4 or fewer > > items of x1-x16 if they are missing. If 4 or fewer items are missing > > from x1-x16, then do; > > [sum of (x1-x16] *4] divided by number of non-missing items. > > > Can you tell me how do i do that? I really appreciate your help and > > effort. > > > Regards, > > Dear, > > I just had a quick question if in case i have something like this > > variables: > > x1-x16 x21 x22 x23 x24. > > How can i do a sum of this like you said before i can simply do > nmiss(x1-x16), but what if the case is as i mentioned above? > > Regards,- Hide quoted text - > > - Show quoted text -


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