I have been having this problem for a while and tried a number of options after googling intensively without any success so I am hoping someone will be able to help!

I am outputting proportion tables using the proportion command and I would like all the categories to appear in the table even if there are no observations in some of the categories.

To be clearer, this is what I’d like to see:

Cat Prop

1 0.45

2 0.05

3 0

4 0.4

5 0.1

This is what I get:

Cat Prop

1 0.45

2 0.05

4 0.4

5 0.1

I have tried the fillin command but it didn't do the trick and I have downloaded the fulltable package but it doesn't deal with survey design (svy) and I need to use that.

In case someone has more time to read, I'll give more information. I am trying to create a table of HIV prevalence by region and civil status. This is saved in excel and will then be used to parameterise a model in matlab. I am using DHS data which involves accounting for survey design and the plan is to have this automated to be able to do it for all countries that have DHS data.

This is the code I prepared to do it:

matrix HIVMen3 = J(8,6,0) **create empty matrix (8 regions, 6 civil status groups)

**fill it with data from the table after converting this into a matrix too

**i (the row) corresponds to the region.

forvalues i=1/8{

svy: tab HIV group if region==`i'

matrix A_`i' = e(b)

matrix list A_`i'

matrix HIVMen3[`i',1] = A_`i'[1, 7]

matrix HIVMen3[`i',2] = A_`i'[1, 8]

matrix HIVMen3[`i',3] = A_`i'[1, 9]

matrix HIVMen3[`i',4] = A_`i'[1, 10]

matrix HIVMen3[`i',5] = A_`i'[1, 11]

matrix HIVMen3[`i',6] = A_`i'[1, 12]

}

matrix rownames HIVMen3 = "Nairobi" "Central" "Coast" "Eastern" "Nyanza" "Rift Valley" "Western" "Northeastern"

matrix colnames HIVMen3 = "Couple" "YMCirc" "YMNCirc" "WidowMCirc" "WidowMNCirc" "Not_sexActive"

matsave HIVMen3, dropall

outsheet using HIVMen3.csv,c

PROBLEM: In 2 of the regions there are no people for 1 of the groups so the matrix produced by Stata has 10 rows instead of 12 and so I can no longer fill the matrix in an automated way

Many thanks in advance!

Annick