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 (November 1999, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 2 Nov 1999 07:26:29 -0500
Reply-To:     john_iwaniszek@worldnet.att.net
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         John Iwaniszek <john_iwaniszek@WORLDNET.ATT.NET>
Organization: AT&T WorldNet Services
Subject:      Re: sum(of...... doesn't work
Content-Type: text/plain; charset=us-ascii

You can't evaluate only part of an expression in if-then statements, you have to evaluate the whole thing. Just remember, the if-then statement evaluates the whole expression, not just some of it. Pick which part of

s{(7*i)-6}-s{i*7}

you want to use, put it in the statement and then lose the sum() function.

John

Jeremy Bassett wrote:

> Can anyone tell me why the sum(of arr{<exp>} - arr{exp}) doesn't work > > This: > > %let stw_parm = 3; > > data test(keep = show1 - show12 subject stw1 - stw12 sympt1 - sympt84); > set in002.symp002; > by subject; > array o{12} show1 - show12; > array w{12} stw1 - stw12; > array s{84} sympt1 - sympt84; > do i = 1 to 12; > o{i} = sum(of s{(7*i)-6}-s{i*7}); > if sum(of s{(7*i)-6}-s{i*7}) > &stw_parm then w{i} = 1; > else w{i} = 0; > end; > run; > > gives this ERROR: > > 350 data test(keep = show1 - show12 subject stw1 - stw12 sympt1 - > sympt84); > 351 set in002.symp002; > 352 by subject; > 353 array o{12} show1 - show12; > 354 array w{12} stw1 - stw12; > 355 array s{84} sympt1 - sympt84; > 356 do i = 1 to 12; > 357 o{i} = sum(of s{(7*i)-6}-s{i*7}); > - > 78 > 358 if sum(of s{(7*i)-6}-s{i*7}) > &stw_parm then w{i} = 1; > - > 78 > 359 else w{i} = 0; > 360 end; > 361 run; > > ERROR 78-322: Expecting a ','. > > NOTE: The SAS System stopped processing this step because of errors.


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