01-07-2018 05:49 AM - edited 01-07-2018 06:00 AM
I have to use proc sql to left join two tables
proc sql; create table a6.s as select f.*, c.* from a6.smb as f left join a6.churn as c on f.PRODUCT_ID=c.PRODUCT_ID; quit;
Table a6.smb has 99999 rows (and 300 columns) and a6.churn has 6465 rows (and 2 columns) . I want to add the column from churn table to smb table where product_id is the common column in the two tables.
when i use this code i get 12930 rows (6465 *2=12930) and 301 columns .
But isnt left join supposed to give me 99999 rows and that's what I want.
What is wrong with my code?
also i get the warning that Product_id already exists in a6.s
01-07-2018 06:55 AM
Each product_id is repeated thrice in a6.smb. but its 9 times in the final a6.s table. Why is it there 9 times?
Because it's also repeated thrice in churn.