Getting started

Run a do-file in your browser

A do-file is a text file containing commands for an analysis. Open it in stats.camp, make the data files it uses available in the workspace, and click Run. The example below includes both the script and its data.

Run a complete example

Open this example and click Run in the script’s tab. It loads student scores from the included CSV file, summarizes three scores, compares mathematics scores across groups, and displays a more detailed mathematics summary.

clear
import delimited "data/student_scores.csv"
summarize math read write
by race: summarize math
summarize math, detail
Open example in browser

Sample data included. Opens in a new tab; click Run.

clear removes the active tab’s working dataset, and import delimited loads the CSV. The remaining commands analyze those rows. Each summary appears with its command; the detailed summary includes percentiles such as the median.

The Run button executes the whole script from the beginning. To execute a single command, enter it in a command entry and press Enter.

Run your own do-file

  1. Open the example workspace above. No sign-in is needed to work in its browser copy.
  2. Choose Upload Files in the Files panel. Select your .do file and the datasets it reads.
  3. Click your .do file in Files to open its commands.
  4. Check the commands that load data. Uploaded files appear at the top level of Files, so change a path such as "data/survey.dta" to "survey.dta" if that is where you uploaded it.
  5. Click Run. Read the output under the commands and inspect the table with Show data.

A do-file usually refers to data stored in a separate file. Uploading the script alone does not supply those data. Replace computer-specific paths such as a Windows drive or a home directory with the file’s path in the workspace.

Write or change commands

To start an empty script, choose the New do file icon in Files, enter a name such as analysis.do, and click the new file to open it. Enter your commands in the script tab. Press Shift+Enter for a line break within a command entry; press Enter to execute that entry.

If a command or option fails, check its command manual for the syntax available in stats.camp. A do-file that relies on a separately installed Stata package also needs an equivalent supported command here.

Save the script

Choose the disk icon labelled Save commands as .do file to save your commands in the workspace. To keep a downloadable copy, right-click the file in Files and choose Download.

Saving a script saves the instructions, not a copy of the current dataset. Keep its input data alongside it. Changes in the public example stay in browser storage and do not sync to GitHub. If you want a project that syncs, sign in with GitHub and choose New project; this creates a private GitHub repository.