ECONOMIC & SOCIAL RESEARCH COUNCIL

Longitudinal Data Analysis
for
Social Science Researchers

 

Stata support materials

 

Key links:

Internal:

External sites:

 

-------------------------------------

  Some handy STATA tips:

- Begin every new session with set more off and set mem 64M (or another size) to adjust STATA's default settings to ones which will be easier for users of large scale survey data

- You can't generate a new variable to the name of one that already exists (eg if repeating a segment of syntax on an existing file and wanting to overwrite an earlier misket). You'll need to drop the variable from the dataset with drop varname

- use numlabel _all, add as a command to ask STATA to show all category values as well as labels on tables and related output

- when opening a new file, use the extension , clear to allow STATA to close off the existing data without wanting to ask you first

- when saving a file, use the extension , replace to allow STATA to overwrite an existing file of that name if there is one

- use the prefix capture ahead of some commands (eg log commands) to tell stata to process the command if relevant, but ignore it if not (this is particularly valuable if running whole do files as batch files)

- For whole batch files (but not interactive do files), use #delimit; to change the command delimiter to a ; (rather than a line break - this allows you to continue over several lines). This setting can't be maintained in an interactive do file - you need to end any lines with the continuation character ///

 

-------------------------------------

Links: Further Stata training and extensions

 

-------------------------------------

Macros:

The following Stata format macro files (do command files) are used within the lab exercise distributed from the page 'workshop materials'  :

seglabelsv1.do

command file which adds text value labels to UK SEG occupational groups

spss2stata.sbs (scroll to link)

SPSS system file that converts an SPSS data file into a format which can be read by Stata whilst also producing Stata command files for adding value labels in Stata. Downloadable from Dirk Enzmann's website.

 

-------------------------------------

Links: Other selected guides on data analysis