Hello, I am a SAS user new to R. What is the R equivalent to following SAS statements:
1) data all; merge test1(in=a) test2(in=b) ; by account_id; if a; run; 2) proc sort data=all nodupkey; by account_id; run; 3) data all test1onnly test2only; merge test1(in=a) test2(in=b) by account_id; if a and b then output all; else if a and not b the output test1only; else if b and not a then output test2only; run; Thanks in advance -- View this message in context: http://r.789695.n4.nabble.com/Merging-data-in-R-compared-to-SAS-tp4640991.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.