Electronic medical records (EMRs) find increasing uses for comparative effectiveness and safety research. However, the lack of analytic methods that handle the issues of missing data and confounding bias jointly, and the onus of model specification limit the use of these data sources. We derive ML, a multiply robust method using machine learning based on our early work on its parametric version (MR) to estimate the average treatment effect. We compare the bias, standard error and coverage probability (CP) of ML to MR, complete case analysis (CC) and regression analysis after multiple imputations (MI). We conduct a simulation study, with data generated from known models of exposure, outcome and missing mechanism and thus the true causal effect is known and used as the benchmark for evaluations. Two settings are studied: a baseline where 40% data are missing and variables relate linearly (on the appropriate scale) to exposure, outcome or missingness, and a challenge where 53% data are missing with non-linearity among variables. The MR and ML methods are applied to an EMR data set to study the effect of implantable cardioverter defibrillators in reducing mortality.