0
我在一些示例數據上使用哈希連接來連接較大的一個小表。在這個例子中,'_1080544_27_08_2016'是較大的表,'_2015_2016_playerlistlookup'是較小的一個。這裏是我的代碼:哈希連接不按要求運行
data both(drop=rc);
declare Hash Plan
(dataset: 'work._2015_2016_playerlistlookup'); /* declare the name Plan for hash */
rc = plan.DefineKey ('Player_ID'); /* identify fields to use as keys */
rc = plan.DefineData ('Player_Full_Name',
'Player_First_Name', 'Player_Last_Name',
'Player_ID2'); /* identify fields to use as data */
rc = plan.DefineDone(); /* complete hash table definition */
do until (eof1) ; /* loop to read records from _1080544_27_08_2016 */
set _1080544_27_08_2016 end = eof1;
rc = plan.add(); /* add each record to the hash table */
end;
do until (eof2) ; /* loop to read records from _2015_2016_playerlistlookup */
set _2015_2016_playerlistlookup end = eof2;
call missing(Player_Full_Name,
Player_First_Name, Player_Last_Name); /* initialize the variable we intend to fill */
rc = plan.find(); /* lookup each plan_id in hash Plan */
output; /* write record to Both */
end;
stop;
run;
這是產生一個與較小的查找表具有相同行數的表。我想查看一個表的大小是否與通過主鍵連接的查找表中的更大字段相同。
較大的表具有重複的主鍵。也就是說,主鍵不是唯一的(例如根據行號)。
有人可以告訴我,我需要修改代碼嗎?
感謝
嗨,謝謝你的回覆。你能否給我這樣的例子代碼,因爲我不知道你在說什麼。謝謝。 – gdogg371
我猜測你想要做什麼 - 如果這不是你想要的,請發佈一些示例數據。 – user667489