|Date: ||Thu, 6 Nov 2008 16:38:00 +0100|
|Reply-To: ||Andre Wielki <wielki@INED.FR>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Andre Wielki <wielki@INED.FR>|
|Subject: ||Re: If then : evidence !|
|Content-Type: ||text/plain; charset=ISO-8859-1; format=flowed|
Indeed Ed the user was not well drilled to SAS and logic of programming.
the sas options in action were
options dkrocond=nowarning nofmterr mergenoby=error msglevel=i mprint notes;
and the code accepted.
The old rule circulating here in France in the years 80 was
"Attention Sas fait toujours quelque chose, mais est-ce exact et correct?"
Sas is producing always some results but is it correct?
Ed Heaton a écrit :
> Makes perfect sense to me. Of course I speak SAS. If I didn't, it would be confusing as h$#@!.
> For those observations where sex holds "M" we run the following conditional test.
> ( 10 and ( sex eq "2" ) )
> Now, 10 is always true, but sex never holds "2" when it holds "M", so the result is false and false is zero. So, zero gets assigned to age.
> If SAS was more like modern, advances languages, they would not allow the same symbol to request an assignment and to request a test for equality. E.g., FORTRAN used = for an assignment and eq for equality testing. C and Java use == for equality testing and = for assignments. Pascal used = for equality testing and := for assignments.
> If SAS followed such rules, the submitted code would have produced an error and the user would have been protected. I would like to see a system option to allow the user to enforce such a rule. E.g.:
> If sex eq "M" then age = 10 and sex eq "2" ;
> would be allowed but
> If sex="M" then age=10 and sex="2" ;
> would generate a syntax error.
> Edward Heaton, Senior Systems Analyst,
> Westat (An Employee-Owned Research Corporation),
> 1650 Research Boulevard, TB-286, Rockville, MD 20850-3195
> Voice: (301) 610-4818 Fax: (301) 294-2085
> mailto:EdHeaton@Westat.com http://www.Westat.com
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Andre Wielki
> Sent: Thursday, November 06, 2008 6:10 AM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: If then : evidence !
> A user here was writing Sas code analogous to this one
> data cl;
> set sashelp.class;
> if sex="M" then age=10 and sex="2"; /*else...;...; */
> As the log was
> 203 data cl;
> 204 set sashelp.class;
> 205 if sex="M" then age=10 and sex="2";
> 206 run;
> NOTE: There were 19 observations read from the data set SASHELP.CLASS.
> NOTE: The data set WORK.CL has 19 observations and 5 variables.
> NOTE: DATA statement used (Total process time):
> real time 0.00 seconds
> cpu time 0.00 seconds
> He was going further!!!!!!!!!!
> I hope everybody reading this is aware of the results!
> If not submit, quick look at the results.
> André WIELKI
> INED (Institut National d'Etudes Démographiques)
> Service Informatique
> 133 Boulevard Davout 75980 Paris Cedex 20
> mél : email@example.com tél : 33 (0) 1 56 06 21 54
INED (Institut National d'Etudes Démographiques)
133 Boulevard Davout 75980 Paris Cedex 20
mél : firstname.lastname@example.org tél : 33 (0) 1 56 06 21 54