I have 4 tables:
I need to get the users from the table 1 that started doing sth in march. This means that I need to exclude from table 1 the users that are in table 2 or table 3 or table 4 (but only for month jan & feb.. and here's my issue: this condition over table 4).
I started this code.
data lib.all_emails_march_start (keep= email1);
merge lib.all_emails_march (IN=In1)
lib.replies_ene_2 (rename= (Mailfrom_Address=email1)) (IN=In2)
lib.replies_feb_2 (rename= (Mailfrom_Address=email1)) (IN=In3)
lib.listings_5 where anomes in ('2014-01', '2014-02') (IN=In4);
by email1;
if (In1=1 and In2=0 and In3=0 and In4=0) then output lib.all_emails_march_start;
run;
but the condition should be only for the table 4 (listings_5) and this variable (anomes) isn't in the other tables (1 to 3), so I don't know how to do this.
I would like to do this in only one stp, and not create first a table for listings with only jan and feb. Would you please give me some ideas?
Thanks!!!! :D :D :D
PROC SQL is probably more suited to this...
proc sql ; create table lib.all_emails_march_start as select * from lib.all_emails_march where user not in(select distinct user from lib.replies_ene_2) and user not in(select distinct user from lib.replies_feb_2) and user not in(select distinct user from lib.listings_5 where anomes in ('2014-01', '2014-02')) ; quit ;