Announcement Icon Online training class for Clinical R programming batch starts on Monday, 02Feb2026. Click here for details.

Import data from Excel workbooks - XLSX


Lesson Description
-
  • Use PROC IMPORT in SAS or readxl in R to read .xlsx files.
  • Specify the sheet name when needed.
  • Update file paths to your local machine.
proc import datafile="path\\mf_data.xlsx"
    out=males
    dbms=xlsx
    replace;
    sheet="Males";
run;
  • DBMS=XLSX reads the Excel workbook.
  • SHEET selects the worksheet to import.
library(readxl)

males <- read_excel("path/mf_data.xlsx", sheet = "Males")
  • read_excel() reads a worksheet into a tibble.
library(readxl)

males <- read_excel("path/mf_data.xlsx", sheet = "Males")
  • Base R can use readxl for .xlsx files.