import delimited: load and verify a CSV

Import a delimited text file, inspect the resulting schema, and confirm that numeric fields and missing values were interpreted as intended.

Tested 2026-08-04 with the current stats.camp development build · View the do-file on GitHub

Open this example View supported commands
Independent software. Not affiliated with, sponsored by, or endorsed by StataCorp LLC.

Dataset and complete example

The example uses a 24-row synthetic CSV created for stats.camp. One field is blank so missing-value handling is visible in the summary.

clear
import delimited "data/student_scores.csv"
describe
summarize math read write

Paths are relative to the project root. The example repository keeps the data under data/ and the do-file under examples/.

Import and describe output

note: delimiter() not specified; detected ','
(encoding: UTF-8)
(6 vars, 24 obs)

Contains data from student_scores.csv
 Observations:            24
    Variables:             6
-------------------------------------------------------------------------------
Variable      Storage   Display    Value
    name         type    format    label      Variable label
-------------------------------------------------------------------------------
id              long    %8.0g
female          long    %8.0g
race            long    %8.0g
read            long    %8.0g
write           long    %8.0g
math            long    %8.0g
-------------------------------------------------------------------------------

The import detected a comma delimiter and UTF-8 encoding, then created six numeric variables and 24 rows.

Verify the import

    Variable |        Obs        Mean   Std. dev.        Min        Max
-------------+---------------------------------------------------------
        math |         24      57.375    7.654567         43         72
        read |         24    56.16667    6.349712         44         68
       write |         23    57.65217     6.69877         46         70

The lower count for write confirms that its blank CSV field became a missing numeric value. This check is more informative than treating a successful import message as proof that every column is correct.

Common import problems

stats.camp also has documented paths for .dta, Excel, and Parquet files. See the current import coverage and Stata's CSV import guide for an external reference.

Related guides

Run this exact example

Clone the example repository in stats.camp and open the exact do-file shown on this page. No stats.camp account is required.

Open this example