|
Dear SAS-L-ers,
John Hendrickx posted the following:
> I'm looking for ways to produce unexpected results in SAS
> that don't generate an error or warning message. Your syntax
> is fine, it works as SAS intended but not as you intended.
> Three examples:
>
> * Inadvertantly respecify a user-defined format. (This does
> generate a note to the log that an existing format has been
> overwritten but that's easy to overlook).
>
> * Using a "numbered range list" in a function, e.g.
> "sum(x1-x5)". This will calculate the sum of x1 minus x5,
> "sum(of x1-x5)" caculates the sum of x1 to x5.
>
> * Forgetting that missing values are represented by minus
> infinity in comparisons.
>
> Are there other nice examples of SAS syntax that looks like
> it does what you want it to at first glance or with
> insufficient coffee?
>
John, as somebody else commented; this _IS_ an interesting thread.
Contributions highlight the small, subtle, currents that can veer the
SAS application boat steadily and subtly off course, so that it misses
the island of correct results.
Though this is not what you are looking for, I'll bet that one of the
biggest producers of unexpected results that "don't generate an error or
warning message" and "works as SAS intended but not as you intended" is
simple program coding mistakes. For instance, somebody coding:
gross_pay = pay_rate + hours_worked;
...instead of:
gross_pay = pay_rate * hours_worked;
Yea, it's easy to read when all alone, but try to find this puppy in a
dog-pound of SAS code hundreds of lines long!
John, best of luck with staying away from subtle SAS mistakes that do
not generate errors!
I hope that this suggestion proves helpful now, and in the future!
Of course, all of these opinions and insights are my own, and do not
reflect those of my organization or my associates. All SAS code and/or
methodologies specified in this posting are for illustrative purposes
only and no warranty is stated or implied as to their accuracy or
applicability. People deciding to use information in this posting do so
at their own risk.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Michael A. Raithel
"The man who wrote the book on performance"
E-mail: MichaelRaithel@westat.com
Author: Tuning SAS Applications in the MVS Environment
Author: Tuning SAS Applications in the OS/390 and z/OS Environments,
Second Edition
http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172
Author: The Complete Guide to SAS Indexes
http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=60409
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
...and bad mistakes, I've made a few... - Queen, We are the Champions
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|