| Date: | Wed, 28 Nov 2001 11:06:38 -0500 |
| Reply-To: | Larry Bertolini <bertolini.1@OSU.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Larry Bertolini <bertolini.1@OSU.EDU> |
| Organization: | Ohio State University |
| Subject: | Re: Using Key= to perform a table lookup |
| Content-Type: | text/plain; charset=us-ascii |
try:
set dealseds key=dealkey/unique;
You could also accomplish this task
with SQL, a merge, a PROC FORMAT,
or a hash look-up. The "best" approach
might depend upon the size of the two
datasets.
Alistair Gordon wrote:
> Using this code:
>
> data spardate;
> set allspar(keep=fund sedol date);
> set dealseds key=dealkey;
> if _iorc_=%sysrc(_dsenom) then
> do;
> error=0;
> delete;
> end;
> run;
>
> Dealseds contains one observation per fund and sedol combination
> required. Dealkey is a composite index on fund and sedol and is not
> specified as unique. Allspar contains multiple instances of the same
> fund and sedol but with differing dates.
>
> Sadly spardate only contains one observation per fund/sedol
> combination and not all the obsevations from allspar.
>
> Can this technique be modified to output all obs from allspar where
> there is a
> match in dealseds?
>
> What other equivalent and efficient techniques might be considered in
> lieu of this?
>
> Many thanks.
|