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

Import data from Excel workbooks - CSV


Lesson Description
-
  • Save the Excel sheet as CSV before importing.
  • Use PROC IMPORT in SAS or readr in R to read the CSV file.
  • Update the file path to match your local machine.
proc import datafile="path\\males.csv"
    out=males
    dbms=csv
    replace;
run;
  • PROC IMPORT reads the CSV file into a SAS dataset named males.
  • DBMS=CSV tells SAS the file format.
library(readr)

males <- read_csv("path/males.csv")
  • read_csv() reads a CSV file into a tibble.
  • Use a full path or set your working directory.
males <- read.csv("path/males.csv", stringsAsFactors = FALSE)
  • read.csv() loads the CSV into a data frame.
  • stringsAsFactors = FALSE keeps character columns as character.