I have the following two tables that I want to left join using Proc SQL. One is a table of user ID's, the other are all the sales invoices.
What I want is to join the invoices table onto the user ID table so that the count of invoices shows up in an "invoices" column. My problem is that the user ID's become duplicated.
proc sql;
create table full as
select count(b.invoices) as invoices, b.user_id, b.invoice_date, a.user_id from customers a
LEFT JOIN invoice_db b
on a.user_id=b.user_id
where invoice_date>='01JAN2019'd
GROUP BY a.user_id;
quit;
The output looks like
1 1607
2 1638
2 1638
1 1665
8 2434
8 2434
What I need is
1 1607
2 1638
1 1665
8 2434