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 (August 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 18 Aug 2006 10:33:05 -0400
Reply-To:     Wensui Liu <liuwensui@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Wensui Liu <liuwensui@GMAIL.COM>
Subject:      Re: hash question
Comments: To: "Dai, Randy" <Randy.Dai@astrazeneca.com>
In-Reply-To:  <E7DF4212AA54D51189B40002A56B1E1E04DAFE32@cnsgcasmsx01.cnsg.astrazeneca.net>
Content-Type: text/plain; charset=ISO-2022-JP; format=flowed

Hi, Randy,

Thank you so much!

If I understand correctly, in the sense of your code, it is something like a outer join, isn't it?

Is it possible to update the data in table Weight directly without creating a new table?

Have a nice weekend!

On 8/18/06, Dai, Randy <Randy.Dai@astrazeneca.com> wrote: > Hi WenSui Liu: > > Not sure if following code answer your question. > > data participants; > input name $ gender:$1. treatment $; > datalines; > John M Placebo > Ronald M Drug-A > Barbara F Drug-B > Alice F Drug-A > ; > data weight(drop=i); > input date:DATE9. @; > do i = 1 to 4; > input name $ weight @; > output; > end; > /* For brevity, only two dates are listed below */ > datalines; > 05May2006 Barbara 125 Alice 130 Ronald 170 John 160 > 04Jun2006 Barbara 122 Alice 133 Ronald 168 John 155 > ; > data results; /*Y is named as VARY*/ > length name treatment $ 8 gender $ 1 VARY $ 1; > if _N_ = 1 then do; > declare hash h(dataset:'participants'); > h.defineKey('name'); > h.defineData('gender', 'treatment'); > h.defineDone(); > end; > set weight; > if h.find() = 0 then VARY=gender; /* Assign to VARY */ > if h.find() = 0 then output; /*Then OUTPOUT*/ > run; > > > > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]On Behalf Of Wensui > Liu > Sent: 2006 $BG/ (B8 $B7n (B18 $BF| (B 8:07 > To: SAS-L@LISTSERV.UGA.EDU > Subject: hash question > > > If I have a hash object defined as: h.definedata("x"), how can I assign the > data value of hash object to a variable, say Y, in data table when their > keys match? > > Thank you so much! > > -- > WenSui Liu > (http://spaces.msn.com/statcompute/blog) > Senior Decision Support Analyst > Health Policy and Clinical Effectiveness > Cincinnati Children Hospital Medical Center >

-- WenSui Liu (http://spaces.msn.com/statcompute/blog) Senior Decision Support Analyst Health Policy and Clinical Effectiveness Cincinnati Children Hospital Medical Center


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