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 2011, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 26 Feb 2011 13:38:52 -0500
Reply-To:     Arthur Tabachneck <art297@ROGERS.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@ROGERS.COM>
Subject:      Re: MAX() function over character values
Comments: To: Yu Zhang <zhangyu05@GMAIL.COM>

Yu,

Easy to explain! Whomever it was who wrote the code that provides the Note made a mistake.

If your where statement really was: >211 where 3 <> 3;

as expected you wouldn't get ANY records.

Art -------- On Sat, 26 Feb 2011 12:16:24 -0600, Yu Zhang <zhangyu05@GMAIL.COM> wrote:

>In SAS doc, it says: > >Note: In a WHERE statement or clause, the <> operator is equivalent to >NE. > >so What i expected from the following code is an empty dataset returned. but >it is not. can some one explain? > >thanks! > > >209 data test; >210 set sashelp.class; >211 where 3 max 3; >212 >213 run; > >NOTE: There were 19 observations read from the data set SASHELP.CLASS. > WHERE 3<>3; >NOTE: The data set WORK.TEST has 19 observations and 5 variables. >NOTE: DATA statement used (Total process time): > real time 0.01 seconds > cpu time 0.01 seconds > > > > >On Sat, Feb 26, 2011 at 9:47 AM, Data _null_; <iebupdte@gmail.com> wrote: > >> You can get help from SAS while consulting the operator precedence docs. >> >> 5 proc print data=sashelp.class; >> 6 where 3 max 1 max 4 min 2; >> 7 where also 2 min 4 max 1 max 3; >> NOTE: WHERE clause has been augmented. >> 8 run; >> >> NOTE: There were 19 observations read from the data set SASHELP.CLASS. >> WHERE (((3<>1)<>4)><2) and (((2><4)<>1)<>3); >> >> >> >> >> On Fri, Feb 25, 2011 at 5:33 PM, Kirby, Ted <ted.kirby@lewin.com> wrote: >> > It appears to me that SAS evaluates this expression from right to left. >> > >> > >> > data _null_; >> > ans1 = 3 <> 1 <> 4 >< 2; >> > ans2 = 2 >< 4 <> 1 <> 3; >> > put ans1=; >> > put ans2=; >> > run; >> > >> > 19 data _null_; >> > 20 ans1 = 3 <> 1 <> 4 >< 2; >> > NOTE: The "<>" operator is interpreted as "MAX". >> > NOTE: The "<>" operator is interpreted as "MAX". >> > 21 ans2 = 2 >< 4 <> 1 <> 3; >> > NOTE: The "<>" operator is interpreted as "MAX". >> > NOTE: The "<>" operator is interpreted as "MAX". >> > 22 put ans1=; >> > 23 put ans2=; >> > 24 run; >> > >> > ans1=3 >> > ans2=2 >> > >> > -----Original Message----- >> > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of >> > Chang Chung >> > Sent: Friday, February 25, 2011 3:31 PM >> > To: SAS-L@LISTSERV.UGA.EDU >> > Subject: Re: MAX() function over character values >> > >> > On Wed, 23 Feb 2011 20:18:12 -0500, Paul Dorfman <sashole@BELLSOUTH.NET> >> > wrote: >> > ... >> >>Methinks the mere fact that the doc does not have examples with more >> > than 2 >> >>operands is no more a sufficient reason to speculate that this is the >> > limit >> >>than to do so with respect to other operators. Would you, for instance, >> >>assume that the absence of an example like >> >> >> >>a+b+c+d >> > ... >> > >> > this would make a great (trick) question on sas expressions. :-) >> > >> > data _null_; >> > ans = 3 <> 1 <> 4 >< 2; >> > put ans=; >> > run; >> > ************* IMPORTANT - PLEASE READ ******************** >> > >> > This e-mail, including attachments, may include confidential and/or >> proprietary information, >> > and may be used only by the person or entity to which it is addressed. >> If the reader of this >> > e-mail is not the intended recipient or his or her authorized agent, the >> reader is hereby >> > notified that any dissemination, distribution or copying of this e-mail >> is prohibited. If you >> > have received this e-mail in error, please notify the sender by replying >> to this message >> > and delete this e-mail immediately. >> > >> > >>


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