Command reference
import delimited — read a CSV or delimited text file
Load a text file into the current dataset. Each row becomes an observation and each field becomes a variable. The importer detects common separators and chooses numeric or text types from the file contents.
Syntax
import delimited "filename.csv" [, options]
Replace filename.csv with the path to a file in your project. Put paths in double quotes, especially when they contain spaces. Options follow a comma; for example, import delimited "scores.csv", clear varnames(1).
Options
Example
This example loads 24 synthetic student records, lists their variable definitions, and summarizes math, reading, and writing scores. It demonstrates the checks to make immediately after an import.
clear
import delimited "data/student_scores.csv"
describe
summarize math read write
Sample data included. Opens in a new tab; click Run.
What to look for
The imported dataset has six variables and 24 observations. Math and reading each have 24 observed values; writing has 23 because one value is missing. A lower observation count in a summary therefore does not necessarily mean that a row was lost during import.