Efficient Cross-tabulation Making with ‘tabout’ Command in STATA · 2016-10-14 · 2015-08-10 1...

Preview:

Citation preview

2015-08-10

1

Efficient Cross-tabulation Makingwith ‘tabout’ Command in STATA

Aug. 9. 2015

Hyungjun SuhSchool of Sociology

University of Arizona

1

1. Install ‘tabout’ Command.

2015-08-10

2

2. Basic Syntax→ tabout [ varlist ] [ if exp ] [ in range ] [ weight =

exp ] using filename [ , options ]* Please see a help file (‘help tabout’) for detailedsyntax.

3.1. Example

It determines amongfrequency, row/columnpercentage.

It indicates the numberof decimal points.

2015-08-10

3

3.2. Example with ‘if’ Command and Weight→ tabout foreign rep78 if price>10000 using

"auto.txt", cells(col) replace f(1)→ tabout foreign rep78 [aw=wt] using

"auto.txt", cells(col) replace f(1)

3.3. Example with Continuous Variables

It tells tabout that thetable is to be a summarytable, a necessaryoption for continuousvariables

It determines thecontent: N mean var sdskewness min max, etc.

2015-08-10

4

3.4. Example Using Multiple Variables

With ‘order’ command and a hyphen from the first variable to thelast variable, you can make cross-tabulations as many as you want atonce.

3.5. Example by Group‘Tabout’command isnot combinedwith ‘by’option. Thus,one needs touse loops to getcross-tabulations bygroup.

2015-08-10

5

3.6. Caveat in Using Loops

In order to make all results in onefile, ‘append’ option is requiredfrom the second command line.

4. Export Result Files to MS Excel

Choose ‘allfiles’ for thefile type andopen the resultfile.

2015-08-10

6

4. Export Result Files to MS Excel (cont.)

4. Export Result Files to MS Excel (cont.)

2015-08-10

7

4. Export Result Files to MS Excel (cont.)

4. Export Result Files to MS Excel (cont.)

2015-08-10

8

• I appreciate Ian Watson, who made thishighly efficient command!

• Questions and Comments tosuhhyungjun@email.arizona.edu.