LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (August 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 30 Aug 2008 15:14:34 -0400
Reply-To:     msz03@albany.edu
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mike Zdeb <msz03@ALBANY.EDU>
Subject:      Re: Lookup Table in SAS
Content-Type: text/plain;charset=iso-8859-1

hi ... and one more idea ... given data sets a and b

data a; input values : $1. @@; datalines; a b c d e ; run;

data b; input values : $1. data1 data2 : $ 10.; datalines; b 1 something x 2 random k 3 new ; run;

* a tweak of Patrick's hash solution; data c; declare hash h(dataset: 'a'); h.defineKey('values'); h.defineDone(); do until (lastb); set b end=lastb; flag = (h.find() eq 0); output; end; stop; run;

-- Mike Zdeb U@Albany School of Public Health One University Place Rensselaer, New York 12144-3456 P/518-402-6479 F/630-604-1475

> Hello, > > Suppose I have dataset called "Lookup_SAS" that has the following values > with 1 variable called values > > values > -------- > a > b > c > d > e > > > I have another dataset with multiple variables with another column called > values also called "data1" > > values data1 data 2 > --------------------------------- > b 1 something > x 2 random > k 3 new > > > How do I create a new dataset that compares my first dataset with the second > to product a flag with the following results: > > values data1 data 2 flag > ----------------------------------------------------------------- > b 1 something 1 > x 2 random 0 > k 3 new 0 > > > > So my question is, how do I create a new variable called flag that contains > any values within "Lookup SAS" into "data1" within a dataset? flag will only > give a 1 if the value within data1 is contained also in Lookup SAS > > Any ideas would be appreciated. > > > Thanks, > -Jerry > >


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