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 (June 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 20 Jun 2008 12:25:36 -0500
Reply-To:     Gregg Snell <sas-l@DATASAVANTCONSULTING.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gregg Snell <sas-l@DATASAVANTCONSULTING.COM>
Subject:      Re: hash table
Comments: To: "Raynaud, Scott" <Scott.Raynaud@TARGETBASE.COM>
In-Reply-To:  <D6EA6D1B6E318A48B30521DE8C6CC6960864A7F1@DMSP-MSG-EVS01.mail.pvt>
Content-type: text/plain; charset=us-ascii

You do not need a separate data step unless you are planning to create views for additional subsetting.

In the paper, I give this example of a data step merge:

data new; merge small(in=a) large(in=b keep=keyvar largevar1 largevar2); by keyvar; if a; run;

which is accomplished using my macro this way:

%hashmerge(data=new, data_a=small, data_b=large, vars_b=largevar1 largevar2, by=keyvar, if=a);

options for the "if" paramerters are: blank, a, b, a or b, a and b

which will address most of the options you are seeking. For additional options, please visit http://www.sascommunity.org/wiki/HASHMERGE to obtain the source code which you can. And if you do add capability, please repost it so others may benefit from your work as well.

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Raynaud, Scott Sent: Friday, June 20, 2008 11:57 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: hash table

Your paper states to specify

data_a= name of first table to merge and typically specified with the option (in=a)

and this is interpreted by the if statement later, but I don't see how in the hash merge example it knows a is the alias for in=1. Do I need a separate data step to set this up?

Thanks

-----Original Message----- From: Gregg Snell [mailto:sas-l@datasavantconsulting.com] Sent: Friday, June 20, 2008 11:25 AM To: Raynaud, Scott; SAS-L@LISTSERV.UGA.EDU Subject: RE: hash table

Have a look at my %HASHMERGE macro.

http://www2.sas.com/proceedings/forum2008/107-2008.pdf

Regards, Gregg Snell

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Scott Raynaud Sent: Friday, June 20, 2008 11:14 AM To: SAS-L@LISTSERV.UGA.EDU Subject: hash table

i'm using the hash below to accomplish a merge. there is no merge statement, hence no alias names to indicate what's in what. i'd like to modify the code below to do the following (separately, of course): say i have two tables, A and B.

1) keep everything in A but drop anything in A and B or in B only 2) keep everything in A and A and B but exclude anything in B only

i suspect setting up some kind of flag is the solution but i'm not exactly sure how to do it in a hash.

thanks

data sasdata.&repeat (keep=pos_card_cust_name pos_trans_key tndr_account_nbr );

declare hash h1(); length pos_trans_key 8 tndr_account_nbr $10;

rc=h1.definekey("pos_trans_key"); rc=h1.definedata("tndr_account_nbr"); rc=h1.definedone();

do until (eof1); /*generate hash table from tender*/ set sasdata.&pos_tndr end=eof1; rc=h1.add (); end;

do until (eof2); /*find records in cardholder that match hash (tender)*/ set sasdata.&pos_card_hldr_name end=eof2; call missing (tndr_account_nbr); rc=h1.find(); /*left join*/ output; end;

run;

[ALERT] -- Access Manager: This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Dissemination, distribution or copying of this e-mail or the information herein by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is prohibited. If you have received this e-mail in error, please immediately notify us by calling our North American Help Desk at (972)506-3939. Targetbase Messaging Services provided by DMSP


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