| Date: | Wed, 15 Mar 2000 09:18:49 GMT |
| Reply-To: | dkb@CIX.COMPULINK.CO.UK |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | dkb@CIX.COMPULINK.CO.UK |
| Organization: | CIX - Compulink Information eXchange |
| Subject: | Re: Applying a "where list" to a dataset id |
|---|
Jeremy Bassett asks:
> I want to spin through some lists holding where clauses and apply them
> sequentially to a dataset ID. Can I do this and what format does the "where
> list" have to be in.
Jeremy,
Yes, you can do this, but not automatically - you can't just point the
where function at a list and a dataset id, you have to build your own process
loop.
The "where list" should be a list of character entries and each entry will
look like the ordinary where clause that you are familiar with in base, except
that
1) the word 'where' doesn't appear
2) you can chain a series of clauses together into a more restrictive compound
clause by prefixing them with 'also '
So you would code something like
wherelist = insertc(wherelist,'name="Jeremy"',-1);
do i = 1 to listlen(wherelist);
rc = where(dsid,getitemc(wherelist,i));
end;
rc will be less than 0 if the where clause has been augmented, cleared or
replaced, greater than 0 for certain errors (e.g. 'where clause requires
compatible variables'). You should check for the latter condition or you may
get incorrect results.
Dave
.
|