Help using Base SAS procedures

Lookup a reference dataset for value

Posts: 0

Lookup a reference dataset for value

Hi Everyone,

I have 2 sas datasets
Dataset A
dateKey dateValue
1012 10/10/2005
1013 05/26/1960

Dataset B
start_date_key xyz abc .....
1012 asdfsfsd sdr4wrwer
1013 sdfrgfgfd dfgfdgdfgdfg

How do I specify in sas to lookup DatasetA's dateKey with Dataset B's start_date_key and retrieve value with least performance impact

Any help in this regard is appreciated

Super Contributor
Super Contributor
Posts: 3,174

Re: Lookup a reference dataset for value

Some choices are (and consider that it depends based on data-volume and look-up return value content):

- use SAS PROC FORMAT to build your look-up table and then use the SAS DATA step PUT function to find a match.
- use SAS DATA step MERGE processing to attempt to match your two files.
- use SAS DATA step SET with KEY= processing to perform a look-up.
- a more recent feature is to consider using SAS DATA step and the HASH table approach to perform your objective.

The SAS support website (with its SEARCH facility) has a wealth reference of SAS-hosted documentation and supplemental technical and conference papers based on topic-oriented subjects.

Proc Format, a Speedy Alternative to Sort Sort Merge
Jenine Milum, Wachovia a Wells Fargo Company, Charlotte, NC

A Hands-On Introduction to SAS® DATA Step Programming
Debbie Buck, D. B. & P. Associates, Houston, TX

Getting Started with the DATA Step Hash Object
Jason Secosky, SAS Institute Inc., Cary, NC
Janice Bloom, SAS Institute Inc., Cary, NC

And more recently from the SGF 2009 confererence:

Scalability of Table Lookup Techniques
Rick Langston, SAS Institute Inc., Cary, NC

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation