efficient cross-tabulation making with ‘tabout’ command in stata · 2016-10-14 · 2015-08-10 1...

8
2015-08-10 1 Efficient Cross-tabulation Making with ‘tabout’ Command in STATA Aug. 9. 2015 Hyungjun Suh School of Sociology University of Arizona 1 1. Install ‘tabout’ Command.

Upload: others

Post on 17-Mar-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

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

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.

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

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.

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

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.

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

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.

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

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.

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

2015-08-10

6

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

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

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

2015-08-10

7

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

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

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

2015-08-10

8

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

• Questions and Comments [email protected].