Dear Stata users,

Thank you in advance. I want to make a table that has all items listed in cells that are grouped by a categorical variable. Let me illustrate with data example and show you what I want to get.

You can use this data example:
Code:
sysuse auto
replace foreign=3 in 1/15
label define origin 3 Whatever, modify
sample 30
keep make foreign
tabulate foreign
Or you can use the following data directly:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str18 make byte foreign
"VW Diesel"        1
"Olds Cutlass"     0
"Cad. Eldorado"    3
"Audi 5000"        1
"Olds Cutl Supr"   0
"Datsun 210"       1
"Olds Omega"       0
"Fiat Strada"      1
"AMC Spirit"       3
"Toyota Corolla"   1
"Chev. Malibu"     0
"Pont. Firebird"   0
"Mazda GLC"        1
"Merc. Monarch"    0
"Honda Accord"     1
"Pont. Grand Prix" 0
"Olds 98"          0
"Volvo 260"        1
"Buick Opel"       3
"Toyota Celica"    1
"Subaru"           1
"Plym. Champ"      0
end
label values foreign origin
label def origin 0 "Domestic", modify
label def origin 1 "Foreign", modify
label def origin 3 "Whatever", modify
And what I want to get is a table like this:
Array