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 11:06:15 -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: "Dorfman, Paul" <paul_dorfman@merck.com>
In-Reply-To:  <4FB5A1689D998C40B6BE0E8A7D1C8AB2266BAF@usctmx1124.merck.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Thank you so much for your reply, Dr Dorfman.

I am reading almost all of your sugi paper and trying to make the most out of hash . I've done a test yesterday and realized that hash could be 50% faster than traditional update.

Right now, I am trying to find out how to use hash to update a table in the database using the data from many small tables without creating more new tables and doing multiple joins.

Again, thanks, Dr Dorfman. Have a nice weekend.

wensui

On 8/18/06, Dorfman, Paul <paul_dorfman@merck.com> wrote: > WenSui, > > First, make sure that when h.definedata("x") is being executed, a host > variable also called X has already been placed into the PDV in some way. It > can come from a SAS file descriptor, LENGTH, valued RETAIN, ATTRIB, FORMAT, > INFORMAT, assignment and sum statements - if I have missed something, fill > in the blanks. When, at the run time, the hash object constructor is asked > to construct a data piece called X, it looks into the PDV (constructed by > the DATA step compiler at the compile time) searching for a variable called > X. If it has not been found in the PDV, the object will stop the step with a > run-time error. If it has, the data piece called X in the hash table will > assume all the attributes of variable X found in the PDV (you can prove it > by dumping the table via h.output() method into a SAS data set and looking > at its content). > > Now if X is in the PDV and the object has been instantiated successfully, > you can call h.find() method. If the current PDV value of the hash key is > present in the table, the object will overwrite it with the value of X tied > to the key value in the table. You *cannot* use the hash data piece X to > write to a PDV variable Y (by the same token as you cannot do it when > writing the results of an embedded SQL query into its host variables - which > is why I have been using the term here by analogy). However, you can assign > the value of X to Y if h.find()'s search has been a success: > > if h.find() = 0 then Y = X ; > > That last line could be the reply in itself, and the most laconic one at > that. Sorry you had to endure what had preceded it. > > Kind regards > ------------ > Paul Dorfman > Jax, FL > ------------ > > +-----Original Message----- > +From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On > +Behalf Of Wensui Liu > +Sent: Thursday, August 17, 2006 8:07 PM > +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 > + > + > > > ------------------------------------------------------------------------------ > Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. > ------------------------------------------------------------------------------ >

-- 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