Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Building pretty crosstabs in putdocx

    Hi Statalist-

    We are seeking some help in formatting tables in putdocx to look, well, pretty. We use Stata 15.1 on both Mac and PC.

    We built the basic cross tabs here https://www.uml.edu/docs/topline-mil...m18-304486.pdf using putdocx, but i build each table individually and then copy and paste into "shells" that we build with the shading and formatting. We are seeking a freelancer to help us build the code that will
    1. format the shading, text, and titles of the table
    2. build the "big tables" that have several characteristics in them. This would allow us to automate our processes further.

    data example here:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long(UML401 voted partlean pid3 income educnew race4 gender) float agebreak4 long ideo3
    2 1 3 2  3 3 1 1 3 3
    1 1 1 1  2 1 3 2 4 1
    1 1 1 1  2 4 1 1 3 1
    2 1 3 2  3 3 4 2 3 3
    4 1 3 2  2 2 1 2 3 3
    1 1 1 1  2 3 1 2 4 1
    1 1 1 1  2 4 1 2 2 1
    1 1 1 1 17 2 4 2 1 1
    7 0 1 5  1 1 2 2 1 6
    5 1 8 5  1 2 1 2 3 6
    1 1 1 1  2 3 1 2 2 1
    1 1 1 3  2 4 1 1 2 2
    2 1 8 5  1 2 1 2 3 6
    1 1 1 1  1 2 1 1 3 1
    1 1 1 1  2 4 1 1 3 1
    1 1 1 1  2 3 1 1 3 1
    1 1 1 3  2 4 1 2 4 1
    2 1 3 2  2 3 1 1 4 3
    7 0 3 2 17 1 1 2 1 3
    1 1 1 1  1 2 1 2 4 1
    1 1 1 1  2 3 1 1 2 1
    1 1 1 1  3 4 1 2 2 1
    2 1 3 3  2 3 1 2 4 2
    1 1 3 3  1 3 1 2 3 2
    7 0 1 1  3 3 1 1 3 1
    1 1 1 1  1 4 1 2 3 1
    1 1 1 1  2 3 2 2 3 1
    1 1 1 3 17 4 1 2 3 1
    1 1 1 3  2 3 1 2 2 2
    2 1 3 2  3 3 1 1 4 3
    1 1 1 4  2 4 1 2 2 1
    1 1 2 4  2 4 1 2 4 1
    7 0 1 1 17 4 1 2 3 1
    7 0 1 1 17 2 1 2 2 2
    1 1 1 3  2 4 1 2 3 1
    2 1 3 2  3 3 1 2 3 2
    1 1 3 2  2 3 4 2 3 3
    2 1 3 2  1 2 1 2 3 2
    1 1 1 1  1 3 1 2 2 1
    1 1 1 1  2 2 1 2 3 6
    2 1 3 3  2 2 1 2 3 3
    1 1 1 1  3 4 1 1 4 1
    7 0 1 1  2 2 1 2 1 1
    7 0 1 1  1 2 1 2 4 2
    2 1 3 2 17 3 1 1 3 3
    1 1 1 1  3 3 1 2 3 1
    3 1 3 4  2 3 1 2 3 3
    7 0 2 3  2 3 1 2 1 2
    7 0 2 3  1 2 1 2 3 2
    2 1 3 2 17 3 1 1 4 3
    2 1 3 2  2 3 1 2 3 2
    1 1 1 1 17 3 1 2 3 1
    2 1 3 2  1 1 1 2 3 3
    2 1 2 3  2 4 1 2 3 3
    1 1 1 1  2 3 4 2 3 1
    3 1 1 3  2 1 1 1 3 2
    1 1 1 1  2 4 1 2 4 3
    1 1 1 1  1 3 1 2 4 1
    1 1 1 1 17 3 4 2 2 2
    1 1 1 1 17 3 1 2 1 1
    2 1 3 2  2 2 1 2 4 2
    1 1 1 1  2 3 1 1 2 1
    1 1 1 1  3 3 1 2 3 1
    1 1 1 1  3 4 1 2 2 1
    1 1 1 1 17 3 1 2 2 1
    2 1 2 3  1 4 1 1 2 3
    2 1 3 2  3 2 1 1 3 2
    1 1 1 3 17 3 1 2 1 1
    2 1 3 2  3 3 1 2 2 3
    1 1 1 1  2 3 1 2 4 1
    3 1 2 3  1 3 1 2 2 6
    1 1 3 2  3 4 1 1 2 2
    2 1 3 2 17 3 1 2 3 3
    1 1 1 1  2 3 1 1 3 2
    2 1 3 2  1 1 1 2 2 3
    2 1 3 3  2 3 1 2 3 3
    1 1 1 3  1 2 3 2 1 3
    2 1 3 2  3 4 1 2 4 3
    1 1 1 1  2 3 1 1 3 1
    2 1 3 2  1 3 1 1 3 3
    1 1 1 1 17 4 1 2 1 1
    1 1 3 2  2 3 1 1 3 2
    1 1 1 1  1 4 2 1 3 2
    7 0 2 3 17 3 1 1 3 2
    1 1 1 1  2 2 4 2 2 2
    7 0 3 2 17 4 1 2 2 3
    2 1 3 2  2 3 1 1 2 3
    1 1 1 1  2 4 1 2 3 1
    1 1 1 3  3 3 1 1 3 1
    2 1 3 2  2 3 1 2 4 3
    1 1 1 1  3 4 1 1 2 1
    1 1 1 1 17 4 1 2 3 1
    1 1 1 1  1 3 1 1 3 1
    1 1 1 1  1 3 1 2 3 1
    1 1 1 1  2 4 1 1 3 1
    1 1 3 2  2 3 1 2 3 2
    1 1 3 3  1 1 1 1 3 3
    1 1 1 3  2 3 1 1 3 1
    1 1 1 1  3 4 1 2 3 1
    2 1 3 2  2 2 1 2 3 2
    end
    label values UML401 UML401
    label def UML401 1 "The Democratic candidate", modify
    label def UML401 2 "The Republican candidate", modify
    label def UML401 3 "Another candidate", modify
    label def UML401 4 "I intentionally left my ballot blank", modify
    label def UML401 5 "I’m not sure", modify
    label def UML401 7 "not asked", modify
    label values voted voted
    label def voted 0 "Did not vote", modify
    label def voted 1 "Voted", modify
    label values partlean pid7
    label def pid7 1 "Democrat", modify
    label def pid7 2 "Independent", modify
    label def pid7 3 "Republican", modify
    label def pid7 8 "Not sure", modify
    label values pid3 pid3
    label def pid3 1 "Democrat", modify
    label def pid3 2 "Republican", modify
    label def pid3 3 "Independent", modify
    label def pid3 4 "Other", modify
    label def pid3 5 "Not sure", modify
    label values income faminc_new
    label def faminc_new 1 "Below 50k", modify
    label def faminc_new 2 "50-100k", modify
    label def faminc_new 3 "100k+", modify
    label def faminc_new 17 "Prefer not to say", modify
    label values educnew educnew
    label def educnew 1 "HS or Less", modify
    label def educnew 2 "Some College", modify
    label def educnew 3 "College Degree", modify
    label def educnew 4 "Post-Grad", modify
    label values race4 race
    label def race 1 "White", modify
    label def race 2 "Black", modify
    label def race 3 "Hispanic", modify
    label def race 4 "Other", modify
    label values gender gender
    label def gender 1 "Male", modify
    label def gender 2 "Female", modify
    label values agebreak4 agebreak4
    label def agebreak4 1 "18-24", modify
    label def agebreak4 2 "25-29", modify
    label def agebreak4 3 "30-34", modify
    label def agebreak4 4 "35+", modify
    label values ideo3 ideo5
    label def ideo5 1 "Liberal", modify
    label def ideo5 2 "Moderate", modify
    label def ideo5 3 "Conservative", modify
    label def ideo5 6 "Not sure", modify
    relevant do file attached. yougovmillennialsforstatalist.do

    The relevant text begins on page 2 of the PDF.

    We are soliciting competitive quotes for this work, but if this is a simple code fix, we'd appreciate the help as well.


    Attached Files
    Last edited by John Cluverius; 23 May 2019, 13:59.
Working...
X