UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Class Notes
Controlling Your Computer


1.0 Stata commands in this unit

. cd -- change directory
pwd -- print working directory
dir -- directory listing
ls -- directory listing
type -- type (display) a file to the screen
mkdir -- make a new directory
copy -- copy a file
erase -- erase (delete) a file

Many of these commands are similar to Unix or DOS commands.

2.0 Demonstration and Explanation

2.1 The pwd, dir & type Commands

. pwd
pwd
dir
dir *.do
ls *.raw
type hsbbatch.do
type ascii.raw
type cls2.log
type schdat.dta

2.2 The mkdir, copy & erase Commands

. mkdir stata2
copy hsb2.dta stata2\hsbnew.dta
cd stata2
dir
erase hsbnew.dta
dir
cd ..
pwd

3.0 Try the commands on your own

. pwd
dir
ls *.raw
mkdir ctata2
copy hsb2.dat stata2\hsbnew.dta
cd stata2
dir
erase hsbnew.dta
dir
cd ..

4.0 Can you answer these questions?

  1. Can you create a new directory, data, inside stata2?
  2. Can you make a copy of hsb2.dta in the data directory?
  3. Can you rename the copy of hsb2.dta to hisch.dta?

5.0 Web Notes

The Stata Class Notes are available on the World Wide Web by visiting ...
      http://www.ats.ucla.edu/stat/stata/notes/

The dataset hsb2.dta can be loaded directly into Stata, over the Internet, using the following command:
use http://www.ats.ucla.edu/stat/stata/notes/hsb2


How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.