Showing posts with label General Social Survey. Show all posts
Showing posts with label General Social Survey. Show all posts

Nov 24, 2021

Decomposing the difference between two means

// GSS 1990-2004
use year race sibs reg16 educ maeduc if inrange(year, 1990, 2004) ///
  & year != 2002 ///  // 2002 measures race in a non-standard way
    using "gss7221_r1.dta", clear

// In Table 7.8 Treiman states that he's got 17,090 cases (14,985 non-black + 
// 2,105 black). There seems to be no way I can get there with the data
// because maeduc, mother's education, only has 15,996 valid observations.

// The reason for this seems to be that in his do-file, he starts with
// the 1990 GSS file and then appends all other GSS year files -- including
// the 1990 file, thus including the 1990 file twice. Running the do-file with

// expand 2 if year == 1990

// uncommented (almost) replicates the numbers reported in the book.

drop year // Not needed

// Race variables
generate black    = (race == 2)
generate nonblack = !black
drop race

// Truncate number of siblings at 15
replace sibs = 15 if sibs > 15  & !missing(sibs)
label var sibs "Sibsize"

// South
gen south = (inrange(reg16, 5, 7))
label var south "Southern origin"
drop reg16

// Education
label var educ "Education"
label var maeduc "Mother's education"

// Listwise deletion
mark touse if !missing(educ, maeduc, sibs)
keep if touse

// Table 7.8a eststo clear local vlist educ maeduc sibs south local upper local lower `vlist' foreach v of local vlist { estpost correlate `v' `lower' if !black local nnonblack = e(N) foreach m in b rho p count { matrix `m' = e(`m') } if "`upper'"!="" { estpost correlate `v' `upper' if black local nblack = e(N) foreach m in b rho p count { matrix `m' = e(`m'), `m' } } ereturn post b foreach m in rho p count { quietly estadd matrix `m' = `m' } eststo `v' local lower: list lower - v local upper `upper' `v' } // Table 7.8b esttab using table2.tex, replace nonumbers noobs mtitles not booktabs label nostar /// title(Correlations between study variables: Blacks (\emph{N} = `nblack') above, non-blacks (\emph{N} = `nnonblack') below the diagonal) /// mtitle("Education" "Mother's education" "Sibsize" "Southern origin") eststo clear eststo: estpost sum educ maeduc sibs south if black eststo: estpost sum educ maeduc sibs south if !black esttab using table1.tex, booktabs replace /// cells("mean(label(Mean) fmt(2))" "sd(label(SD) fmt(2) par)") /// label mtitle("Blacks" "Non-Blacks") /// title("Means and standard deviations of study variables")
// Table 7.9 eststo clear eststo: regress educ maeduc sibs south if touse & black eststo: regress educ maeduc sibs south if touse & !black esttab using table3.tex, booktabs replace /// b(2) se(2) r2(2) /// label mtitle("Blacks" "Non-Blacks") /// title("Coefficients of a model of years of schooling, for blacks and non-blacks, US adults, 1990--2004") // Table 7.10 eststo clear eststo: oaxaca educ maeduc sibs south if touse, by(black) detail noisily eststo: oaxaca educ maeduc sibs south if touse, by(nonblack) detail noisily esttab using table4.tex, booktabs replace /// b(2) nose not label mtitle("Blacks as reference" "Non-Blacks as reference") /// eqlabel("\emph{Overall}" /// "\emph{Differences in assets}" /// "\emph{Differences in returns to assets}" /// "\emph{Interactions}") /// coeflabels(overall:difference "Difference in years of schooling" /// overall:endowments "Total due to difference in assets" /// overall:coefficients "Total due to difference in returns" /// overall:interaction "Total due to interactions") /// drop(overall:group*) /// varwidth(30) alignment(D{.}{.}{-1}) /// title("Decomposition of the difference in the mean years of schooling by blacks and non-blacks, US adults, 1990--2004")

Apr 24, 2020

Random graphs (145): Uncluttered line graphs

// Open General Social Survey data
use wtssall year health1 parsol ///
    if inlist(year, 2002, 2004, 2006, 2010, 2014, 2018) ///
    using "data/GSS7218_R2.DTA", clear

// Listwise deletion
keep if !missing(health1, parsol)

// Fix health variable
recode health1 (4 5   = 1 "Poor health") ///
               (3 2 1 = 0 "Good health"), gen(poorhealth)
label var poorhealth "Poor health"

// Collapse data set
collapse poorhealth [pw = wtssall], by(year parsol)
replace poorhealth = poorhealth * 100

// Create figure
foreach x of numlist 2002 2006 2010 2014 2018 {
 local 2002 gs11
 local 2006 gs11
 local 2010 gs11
 local 2014 gs11
 local 2018 gs11
 local `x'  red
 twoway (line poorhealth parsol if year == 2002, lcolor(`2002') lstyle(solid)) ///
        (line poorhealth parsol if year == 2006, lcolor(`2006') lstyle(solid)) ///
        (line poorhealth parsol if year == 2010, lcolor(`2010') lstyle(solid)) ///
        (line poorhealth parsol if year == 2014, lcolor(`2014') lstyle(solid)) ///
        (line poorhealth parsol if year == 2018, lcolor(`2018') lstyle(solid)) ///
       , title({bf:`x'}, justification(left) bexpand span) ///
         ytitle("% poor health") ///
         xtitle("Living standard compared to parents'") ///
         xlabel(1 `""Much" "better""' ///
                2 `""Somewhat" "better""' ///
                3 `""About" "the same""' ///
                4 `""Somewhat" "worse""' ///
                5 `""Much" "worse""' ///
                , val) ///
         name(year`x', replace) legend(off) nodraw
}

graph combine year2002 ///
              year2006 year2010 ///
              year2014 year2018, ///
      col(2) ysize(8) altshrink ///
      note("{it: Note:} Weighted with WTSSALL", size(vsmall)) ///
      name(figure, replace)

Feb 14, 2018

Handling missing values in Stata

This allows replicating the analyses in Allison (2002, pp. 68-73).
// MI example 2
use spanking age educ income91 sex race marital region childs god using "C:\Users\User\Dropbox (FAMSIZEMATTERS)\methods and data\GSS1994.dta", clear
recode spanking (1 = 4) (2 = 3) (3 = 2) (4 = 1)
generate female  = (sex == 2)
generate black   = (race == 2)
recode income91 ( 1 =   500) ( 2 =  2000) ( 3 =  3500) ( 4 =  4500) ( 5 =  5500) /// 
                ( 6 =  6500) ( 7 =  7500) ( 8 =  9000) ( 9 = 11250) (10 = 13750) ///
                (11 = 16250) (12 = 18750) (13 = 21250) (14 = 23750) (15 = 27500) ///
                (16 = 32500) (17 = 37500) (18 = 45000) (19 = 55000) (20 = 67500) ///
                (21 = 75000), gen(income)
replace income = income / 1000

generate nochild = (childs == 0)         if !missing(childs)
generate nodoubt = (god == 6)            if !missing(god)
generate nevmar  = (marital == 5)        if !missing(marital)
generate divsep  = inlist(marital, 3, 4) if !missing(marital)
generate widow   = (marital == 2)        if !missing(marital)
generate east    = inlist(region, 1, 2)
generate midwest = inlist(region, 3, 4)
generate south   = inlist(region, 5, 6, 7)

misschk spanking female black income educ nodoubt nochild age east midwest south nevmar divsep widow

eststo clear
eststo: ologit spanking female black income educ nodoubt nochild age east midwest south nevmar divsep widow

drop if missing(marital)

preserve
recode educ (.d .n = .) 
recode spanking (.d .i .n = .)

mi set mlong
mi register imputed spanking female black income educ nodoubt nochild age east midwest south nevmar divsep widow

mi impute mvn spanking female black income educ nodoubt nochild age east midwest south nevmar divsep widow, ///
   add(5) burnin(500) burnbetween(200) emlog emoutput

foreach x of varlist female black nodoubt nochild east midwest south nevmar divsep widow {
   replace `x' = 0 if `x'  < .5 & _mi_m != 0
   replace `x' = 1 if `x' >= .5 & _mi_m != 0
}

replace spanking = 1 if                   spanking < 1.5 & _mi_m != 0
replace spanking = 2 if spanking >= 1.5 & spanking < 2.5 & _mi_m != 0
replace spanking = 3 if spanking >= 2.5 & spanking < 3.5 & _mi_m != 0
replace spanking = 4 if spanking >= 3.5                  & _mi_m != 0

eststo: mi estimate, post: ologit spanking female black income educ nodoubt nochild age east midwest south nevmar divsep widow
restore

preserve
recode educ (.d .n = .) 
recode spanking (.d .i .n = .)

mi set mlong
mi register imputed spanking female black income educ nodoubt nochild age east midwest south nevmar divsep widow

mi impute chained (mlogit) spanking (regress) income educ (logit) nodoubt nochild = female black age east midwest south nevmar divsep widow, ///
   add(5) burnin(20) force

eststo: mi estimate, post: ologit spanking female black income educ nodoubt nochild age east midwest south nevmar divsep widow
restore

preserve
mi set mlong
mi register imputed spanking female black income educ nodoubt nochild age east midwest south nevmar divsep widow

drop if missing(spanking)
mi impute chained (mlogit) spanking (regress) income educ (logit) nodoubt nochild = female black age east midwest south nevmar divsep widow, ///
   add(5) burnin(20) force

eststo: mi estimate, post: ologit spanking female black income educ nodoubt nochild age east midwest south nevmar divsep widow
restore

esttab, wide se keep(spanking:) nonumbers modelwidth(15) ///
  mtitle("Listwise deletion" "Normal data augmentation" "Sequential regression" "Seq. regression w/out missings") ///
  title(Coefficient estimates and standatd errors for cumulative logit models predicting SPANKING)

Reference

Allison, Paul D. 2002. Missing Data. Sage. doi: 10.4135/9781412985079

Oct 5, 2015

Firebaugh (1997): Analyzing Repeated Surveys in Stata (ch. 6)

use year age race partyid sex educ region if inlist(year, 1973, 1974, 1994) ///
    using GSS7214_R4.DTA, clear

replace year = 1974 if year == 1973

// Create sample
drop if partyid == 7
keep if race < 3
keep if !missing(year, age, race, partyid, sex, educ, region)

// Create variables
generate strongdem = (partyid == 0) * 100
generate white     = (race == 1)
generate south     = inlist(region, 5, 6, 7)
generate y1994     = (year == 1994)
generate y1974     = (year == 1974)
generate female    = (sex == 2)
replace  age       = age - 16 // Give 0 more meaningful value

drop sex region race partyid

// Table 6.2
reg   strongdem y1994##white
estimates store ols
logit strongdem y1994##white
estimates store logit

esttab ols logit logit ///
     , p wide eform(0 0 1) not ///
       coeflabel(1.y1994 "1994 dummy" ///
                 1.white "White (ref. black)" ///
                 1.y1994#1.white "White X 1994 dummy" ///
                 _cons "Intercept") ///
       drop(0b.y1994 0b.white ///
            0b.y1994#0b.white ///
            0b.y1994#1o.white ///
            1o.y1994#0b.white) ///
       mtitles("OLS" "Logit" "Odds ratios") varwidth(24)
        
                          
// Table 6.3
logit strongdem y1994##white y1994##c.educ
estimates store logit

esttab logit logit
     , p wide eform(0 1) ///
       coeflabel(1.y1994 "1994 dummy" ///
                 1.white "White (ref. black)" ///
                 1.y1994#1.white "White X 1994 dummy" ///
                 educ "Education (in yrs.)" ///
                 1.y1994#c.educ "Education X 1994 dummy" ///
                 _cons "Intercept") ///
       drop(0b.y1994 0b.white ///
            0b.y1994#0b.white ///
            0b.y1994#1o.white ///
            0b.y1994#co.educ  ///
            1o.y1994#0b.white) ///
       mtitles("Logit" "Odds ratios") varwidth(24)
        
// Table 6.4
logit strongdem y1974##white y1974##c.educ
estimates store logit

esttab logit logit ///
     , p wide eform(0 1) ///
       coeflabel(1.y1974 "1974 dummy" ///
                 1.white "White (ref. black)" ///
                 1.y1974#1.white "White X 1974 dummy" ///
                 educ "Education (in yrs.)" ///
                 1.y1974#c.educ "Education X 1974 dummy" ///
                 _cons "Intercept") ///
       drop(0b.y1974 0b.white ///
                 0b.y1974#0b.white ///
                 0b.y1974#1o.white ///
                 0b.y1974#co.educ  ///
                 1o.y1974#0b.white) ///
       mtitles("Logit" "Odds ratios") varwidth(24)
                          
// Table 6.5
logit strongdem y1994##white y1994##c.educ south female c.age##c.age
estimates store logit

esttab logit logit ///
     , p wide eform(0 1) ///
       coeflabel(1.y1994 "1994 dummy" ///
                 1.white "White (ref. black)" ///
                 1.y1994#1.white "White X 1994 dummy" ///
                 educ "Education (in yrs.)" ///
                 1.y1994#c.educ "Education X 1994 dummy" ///
                 south "South (ref. rest of US)" ///
                 female "Female (ref. male)" ///
                 age    "Age" ///
                 c.age#c.age "Age squared" ///
                 _cons "Intercept") ///
       drop(0b.y1994 0b.white ///
                 0b.y1994#0b.white ///
                 0b.y1994#1o.white ///
                 0b.y1994#co.educ  ///
                 1o.y1994#0b.white) ///
       mtitles("Logit" "Odds ratios") varwidth(24)
    
// Table 6.6
logit strongdem y1974##white y1974##c.educ south female c.age##c.age
estimates store logit

esttab logit logit
     , p wide eform(0 1) ///
       coeflabel(1.y1974 "1974 dummy" ///
                 1.white "White (ref. black)" ///
                 1.y1974#1.white "White X 1974 dummy" ///
                 educ "Education (in yrs.)" ///
                 1.y1974#c.educ "Education X 1974 dummy" ///
                 south "South (ref. rest of US)" ///
                 female "Female (ref. male)" ///
                 age    "Age" ///
                 c.age#c.age "Age squared" ///
                 _cons "Intercept") ///
       drop(0b.y1974 0b.white ///
                 0b.y1974#0b.white ///
                 0b.y1974#1o.white ///
                 0b.y1974#co.educ  ///
                 1o.y1974#0b.white) ///
       mtitles("Logit" "Odds ratios") varwidth(24)
The last tables of the chapter make use of an occupation variable that I cannot find in the data/I can't be bothered to harmonize the ones that I can find.

Reference

Firebaugh, Glenn. 1997. Analyzing Repeated Surveys. Sage. doi: 10.4135/9781412983396

Oct 4, 2015

Firebaugh (1997): Analyzing Repeated Surveys in Stata (ch. 4)

Note how this is restricted to the linear decompositions!

Intracohort change versus overall change


use year race age cohort racmar using GSS7214_R4.DTA, clear

// Select sample
keep if inlist(year, 1974, 1984, 1994)
keep if race == 1   // Whites only
keep if age >= 20   
keep if !missing(age, racmar)

// Generate 10-year cohort variable
generate cohort10 = .
local lowerbracket = 1965
local upperbracket = 1974

foreach x of numlist 1/10 {
 replace cohort10 = `x' if cohort >= `lowerbracket' & cohort <= `upperbracket'
 label define cohort10 `x' "`lowerbracket' to `upperbracket'", modify
 local lowerbracket = `lowerbracket' - 10
 local upperbracket = `upperbracket' - 10
}

label value cohort10 cohort10
label var year "Year"

// Opposing interracial marriage
recode racmar (1 = 1 "Yes") (2 = 0 "No") (.d .i .n = .), gen(oppose)
label var oppose "Opposes interracial marriage"
generate oppose_perc = oppose * 100

// Create Table 4.1 without change
table cohort10 year, contents(mean oppose_perc n oppose_perc) format(%9.1f) center

// Different version of Table 4.1, including calculated changed
preserve
qui table cohort10 year, contents(mean oppose_perc n oppose_perc) format(%9.1f) center replace
rename table1 oppose_perc 
rename table2 oppose_n
reshape wide oppose_perc oppose_n, i(cohort10) j(year)
gen change1984 = oppose_perc1984 - oppose_perc1974 
gen change1994 = oppose_perc1994 - oppose_perc1984 
format change1984 change1994 %9.1f
list, noobs sep(0) abbreviate(20) subvar
restore

Empirical example for linear decomposition: Trend in antiblack prejudice

use year race cohort racdin racpush racseg racmar using GSS7214_R4.DTA, clear

// Create sample
keep if inlist(year, 1972, 1976, 1980, 1984)
keep if race == 1

// Create outcome
alpha racdin racpush racseg racmar, item
egen zracdin  = std(racdin)
egen zracpush = std(racpush)
egen zracseg  = std(racseg)
egen zracmar  = std(racmar)
scores y = total(zracdin zracpush zracseg zracmar), minvalid(3)
gen prejudice = 6 - y  // Difficult to figure out the exact outcome
drop y                 // But this seems to be close enough

// Calculate total change in prejudice
mean prejudice, over(year) coeflegend
local totalchange = _b[1984] - _b[1972]

// Calculate annual change within cohorts
reg prejudice year cohort
local b1 = _b[year]
local b2 = _b[cohort]

// Calculate contributions of intracohort change and cohort replacement
local intracohort = `b1' * (1984 -1972)
di `intracohort'

qui mean cohort, over(year) coeflegend
local cohortreplacement = `b2' * (_b[1984] - _b[1972])
di `cohortreplacement'

// Calculate estimated total change
local estim_change = `intracohort' + `cohortreplacement'
di `estim_change'

// Output results
matrix results = (`totalchange')\(`b1')\(`b2')\(`intracohort')\(`cohortreplacement')\(`estim_change')
esttab matrix(results, fmt(%9.2f)), coeflabel(r1 "Total change" ///
                                              r2 "Intracohort slope" ///
                                              r3 "Intercohort slope" ///
                                              r4 "Estimated contribution of intracohort change" ///
                                              r5 "Estimated contribution of cohort replacement" ///
                                              r6 "Estimated total change") ///
                                              mtitle("Result")  ///
                                              varwidth(45)

Empirical example of the same-sign rule: Gender role attitudes

use year cohort fework fepres fepol fehome if year >= 1972 & year <= 1988 using GSS7214_R4.DTA, clear

// Prepare variables
recode fework fepres (2 = 0)
recode fepol fehome  (2 = 1) (1 = 0)

// Create sample for Table 4.2
preserve
keep if inlist(year, 1972, 1974, 1988)
fre year
gen id = _n
reshape wide fework fepres fepol fehome, i(id) j(year)
replace fepol1972 = fepol1974
replace fehome1972 = fehome1974
reshape long
drop if year == 1974
recode year (1972 = 0 "1972") (1988 = 1 "1988"), gen(yr)

// Table 4.2
foreach y of varlist fework fepres fepol fehome {
 qui regress `y' yr
 local mean1972 = _b[_cons]
 local mean1988 = _b[_cons] + _b[yr]
 local differen = _b[yr]
 local t        = _b[yr] / _se[yr]
 *di "`y'" _skip(5) `mean1972' _skip(5) `mean1988' _skip(5) `differen' _skip(5) `t'
 matrix stuff1 = (`mean1972' , `mean1988' , `differen' , `t')
 if "`y'" == "fework" matrix table42 = stuff1
 else matrix table42 = (table42\stuff1)
}
 
matrix rownames table42 = "WORK" "PRES" "POLI" "HOME"
matrix colnames table42 = "Mean 1972" "Mean 1988" "Change" "t-value"
esttab matrix(table42, fmt(3 3 3 1))

restore

// Table 4.3
foreach y of varlist fework fepres fepol fehome { qui logit `y' year cohort local n = e(N) local intracohort = _b[year] local intracohort_t = _b[year] / _se[year] local intercohort = _b[cohort] local intercohort_t = _b[cohort] / _se[cohort] *di "`y'" _skip(5) `n' _skip(5) `mean1988' _skip(5) `differen' _skip(5) `t' matrix stuff = (`n', `intracohort', `intracohort_t', /// `intercohort', `intercohort_t') if "`y'" == "fework" matrix table43 = stuff else matrix table43 = (table43\stuff) } matrix rownames table43 = "WORK" "PRES" "POLI" "HOME" matrix colnames table43 = "N" "Within cohort" "t" "Cross-cohort" "t" esttab matrix(table43, fmt(0 %9.3f %9.1f %9.3f %9.1f)), modelwidth(14)

Reference

Firebaugh, Glenn. 1997. Analyzing Repeated Surveys. Sage. doi: 10.4135/9781412983396

Oct 3, 2015

Firebaugh (1997): Analyzing Repeated Surveys in Stata (ch. 3)




set maxvar 6000
use GSS7214_R4.DTA, clear

fre sample
// Try to recreate sample
drop if sample == 4 // FP 1970 Black oversample
drop if sample == 5 // BFP 1980 Black oversample
drop if sample == 7 // FP 1980 Black oversample

// Retirement status
fre wrkstat

generate retired_others  = (wrkstat == 5)
generate retired_workers = (wrkstat == 5)
replace  retired_workers = . if inlist(wrkstat, 7, 6, 8) // Exclude homemakers, 
                                                         // students, and others
// Spending on education
gen ed_toolittle = 0
replace ed_toolittle = 1 if nateduc == 1 & !missing(nateduc)
replace ed_toolittle = 0 if nateduc  > 1 & !missing(nateduc)
replace ed_toolittle = . if missing(nateduc)

gen ed_toomuch = 0
replace ed_toomuch = 1 if nateduc == 3 & !missing(nateduc)
replace ed_toomuch = . if missing(nateduc)

// Spending on social security
gen ss_toolittle = 0
replace ss_toolittle = 1 if natsoc == 1 & !missing(natsoc)
replace ss_toolittle = 0 if natsoc  > 1 & !missing(natsoc)
replace ss_toolittle = . if missing(natsoc)

gen ss_toomuch = 0
replace ss_toomuch = 1 if natsoc == 3 & !missing(natsoc)
replace ss_toomuch = 0 if natsoc  < 3 & !missing(natsoc)
replace ss_toomuch = . if missing(natsoc)

eststo clear
// Table 3.1

preserve
keep if year >= 1973 & year <= 1993
gen trend = year - 1973

eststo: logit ed_toomuch     c.trend##retired_others
eststo: logit ed_toolittle   c.trend##retired_others
 
eststo: logit ed_toomuch     c.trend##retired_workers
eststo: logit ed_toolittle   c.trend##retired_workers

esttab est1 est2 est3 est4 using table3.1.tex, replace varwidth(50) ///
       booktabs label ///
       mgroups("Retirees vs. others" "Retirees vs. workers", pattern(1 0 1 0) ///
       prefix(\multicolumn{@span}{c}{) suffix(})   ///
       span erepeat(\cmidrule(lr){@span}))         ///
       alignment(D{.}{.}{-1}) page(dcolumn) nonumber ///
       b(%9.3f) not ///
       drop(0b.retired_others ///
            0b.retired_others#co.trend ///
            0b.retired_workers ///
            0b.retired_workers#co.trend ///
   _cons) ///
    rename(1.retired_others 1.retired_workers ///
              1.retired_others#c.trend 1.retired_workers#c.trend) ///
       coeflabels(1.retired_workers "Initial difference, retirees minus workers/others" ///
               trend "Trend for retirees" ///
      1.retired_workers#c.trend "Trend difference retirees minus workers/others" ///
                  1.retired_others "Initial difference, retirees minus others" ///
      1.retired_others#c.trend "Trend difference retirees minus workers/others") ///
       mlabels("\multicolumn{1}{c}{Too much}" ///
            "\multicolumn{1}{c}{Too little}" ///
      "\multicolumn{1}{c}{Too much}" ///
            "\multicolumn{1}{c}{Too little}") ///
       order(1.retired_workers trend 1.retired_workers#c.trend) ///
    title("Table 3.1: Trend analysis for spending on education, 1973-1993: Logit coefficients")

restore

// Table 3.2
preserve
keep if year >= 1984 & year <= 1993
gen trend = year - 1984

eststo: logit ss_toomuch   c.trend##retired_others
eststo: logit ss_toolittle c.trend##retired_others
eststo: logit ss_toomuch   c.trend##retired_workers
eststo: logit ss_toolittle c.trend##retired_workers

esttab est5 est6 est7 est8 using table32.tex, replace varwidth(50) ///
       booktabs label ///
       mgroups("Retirees vs. others" "Retirees vs. workers", pattern(1 0 1 0) ///
       prefix(\multicolumn{@span}{c}{) suffix(})   ///
       span erepeat(\cmidrule(lr){@span}))         ///
       alignment(D{.}{.}{-1}) page(dcolumn) nonumber ///
       b(%9.3f) not ///
       drop(0b.retired_others ///
            0b.retired_others#co.trend ///
            0b.retired_workers ///
            0b.retired_workers#co.trend ///
   _cons) ///
    rename(1.retired_others 1.retired_workers ///
              1.retired_others#c.trend 1.retired_workers#c.trend) ///
       coeflabels(1.retired_workers "Initial difference, retirees minus workers/others" ///
               trend "Trend for retirees" ///
      1.retired_workers#c.trend "Trend difference retirees minus workers/others" ///
                  1.retired_others "Initial difference, retirees minus others" ///
      1.retired_others#c.trend "Trend difference retirees minus workers/others") ///
       mlabels("\multicolumn{1}{c}{Too much}" ///
            "\multicolumn{1}{c}{Too little}" ///
      "\multicolumn{1}{c}{Too much}" ///
            "\multicolumn{1}{c}{Too little}") ///
       order(1.retired_workers trend 1.retired_workers#c.trend) ///
    title("Table 3.2: Trend analysis for spending on social security, 1984-1993: Logit coefficients")
restore

Reference

Firebaugh, Glenn. 1997. Analyzing Repeated Surveys. Sage. doi: 10.4135/9781412983396