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 (June 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 6 Jun 2002 08:55:00 -0700
Reply-To:     Dale McLerran <stringplayer_2@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Dale McLerran <stringplayer_2@YAHOO.COM>
Subject:      Re: Missing = zero; Immediate If?
Comments: To: Ian Whitlock <WHITLOI1@WESTAT.com>
In-Reply-To:  <08B08C9FA5EBD311A2CC009027D5BF8102E2B0BD@remailnt2-re01.westat.com>
Content-Type: text/plain; charset=us-ascii

OK, I'm with the program now. An approach employing formats is fine for expressions in the test of the condition. You and Howard are right that expressions in the assignment cannot be conveniently handled employing formats. That is the piece which I was overlooking.

Dale

--- Ian Whitlock <WHITLOI1@WESTAT.com> wrote: > Dale, > > You said in part > > >>>>>>>>>>>>>>>>>>>> > I don't see why one can't use formats for expressions. The > expression > in an IIF evaluates to either true or false. An expression can be > coded as the first argument to a put or input function. It is easy > to format a binary value. Consider > > proc format; > invalue test > 0 = 5 > 1 = 10; > run; > > data _null_; > condition='F'; > value = input(condition='T',test.); > put _all_; > condition='T'; > value = input(condition='T',test.); > put _all_; > run; > <<<<<<<<<<<<<<<<<<<< > > The short answer is that it does not work well and will be very > difficult to > implement in practice. > > To do better let me present an exercise. Please implement the > following > pseudo code following your format suggestion. > > data w ( drop = i obs ) ; > array x (20) ; > do obs = 1 to 50 ; > do i = 1 to dim ( x ) ; > x[i] = ranuni ( 29573 ) ; > end ; > output ; > end ; > run ; > > data w2 ( keep = a b c ) ; > set w ; > array x (20) ; > do i = 2 to 19 ; > a = x[i] ; > b = x[i-1] ; > c = iff (( a > b , x[i+1] , 0 ) ; /* pseudo sas code */ > output ; > end ; > run ; > > I realize one could write code to implement the pseudo code rather > easily in > several different ways, but I am not asking that. Remember you are > to use > your format method of implementation. When you show the code we > should be > in a better position to understand the issues and reasons for > Howard's > rejection of the method. > > IanWhitlock@westat.com

===== --------------------------------------- Dale McLerran Fred Hutchinson Cancer Research Center mailto: dmclerra@fhcrc.org Ph: (206) 667-2926 Fax: (206) 667-5977 ---------------------------------------

__________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com


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