LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2001, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 28 Dec 2001 21:29:17 +0000
Reply-To:   Puddin' Man <pudding_man@POSTMARK.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Puddin' Man <pudding_man@POSTMARK.NET>
Subject:   Using a lookup Table in SAS
Comments:   To: scottchupack@yahoo.com
Content-Type:   text/plain; charset="iso-8859-1"

Scott,

You've had several helpful suggestions re table lookup. Most educational ...

As regards your problem/data as presented, it might bear mentioning that you don't need a table lookup to get the state info. SAS supplies a small group of ZIP* functions that accept a 5 character zip as input. They are illustrated below (W2k SAS 8.1):

75 Data Set1; 76 length zip $5; 77 input Name $ Zip $; 78 state_abbrev=zipstate(zip); 79 state_nameuc=zipname(zip); *** upper case ***; 80 state_namemc=zipnamel(zip); *** mixed case ***; 81 put _all_; 82 cards;

zip=48335 Name=Scott state_abbrev=MI state_nameuc=MICHIGAN state_namemc=Michigan _ERROR_=0 _N_=1 zip=48335 Name=Bill state_abbrev=MI state_nameuc=MICHIGAN state_namemc=Michigan _ERROR_=0 _N_=2 zip=60031 Name=Mark state_abbrev=IL state_nameuc=ILLINOIS state_namemc=Illinois _ERROR_=0 _N_=3 zip=60045 Name=Mike state_abbrev=IL state_nameuc=ILLINOIS state_namemc=Illinois _ERROR_=0 _N_=4

Hope this is helpful ...

Puddin'

******************************************************* *** Puddin' Man *** Pudding_Man@postmark.net ***** *******************************************************;

From: Scott Chupack (scottchupack@yahoo.com) Subject: Using a lookup Table in SAS

I am a relatively new user of SAS and I am trying to figure out how to use lookup tables in SAS. What I would like to do is have a master data set with a field and based on the results of that field I would bring in the corresponding entry in the second data set.

For example:

Data Set 1: Name Zip Scott 48335 Bill 48335 Mark 60031 Mike 60045

Data Set 2: Zip State 48335 MI 60031 IL 60045 IL 90046 CA

Result: Scott 48335 MI Bill 48335 MI Mark 60031 IL Mike 60031 IL


Back to: Top of message | Previous page | Main SAS-L page