Date: Mon, 15 Nov 1999 17:42:27 +1100
Reply-To: Tim CHURCHES <TCHUR@DOH.HEALTH.NSW.GOV.AU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tim CHURCHES <TCHUR@DOH.HEALTH.NSW.GOV.AU>
Subject: SASTrap: WHERE clauses and ANNOTATE datasets
Content-Type: text/plain; charset=US-ASCII
Fellow Slingers of SAS code,
This is something which provoked much cursing in our SAS sweat shop.
It seems that when a WHERE clause is used with PROC GPLOT (and probably
other SAS graphics procedures) it also applies to the ANNOTATE dataset,
if it is able to. What do I mean by "if it is able to"?
Well, consider a WHERE clause such as:
where sex = 'M' ;
Normally, an ANNOTATE dataset would not contain a variable called "sex",
and as a result, the above WHERE clause has no effect at all on the resulting
annotation of the graph..
But if the ANNOTATE dataset does happen to contain a variable called sex, then
those rows (observations) in the ANNOTATE dataset where sex ne 'M' will NOT be
used by the annotate processor and therefore will not result in annotations on the
OK, what's the problem with that, you might ask?
Well, usually, if a WHERE clause applies to a dataset but that dataset does not contain
a variable referred to in the WHERE clause, then an ERROR message will appear
in the LOG, or at least a NOTE. With PROC GPLOT (and probably other SAS
graphics procedures), no such ERROR message or NOTE appears in the LOG when
variables referred to in the WHERE clause are missing from the ANNOTATE dataset.
This caused us to labour under the delusion that the WHERE clause therefore has no
effect on the ANNOTATE dataset. Wrong! It does, if the variables referred to in the WHERE
clause happen to be present in the ANNOTATE dataset. This is inconsistent behaviour on
the part of SAS, is it not? Or are we slowly going mad?