[R] Merging data in R compared to SAS

ramoss ramine.mossadegh at finra.org
Wed Aug 22 16:59:04 CEST 2012


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.



More information about the R-help mailing list