Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: SVY medians and Elixhauser

 From Mike Butterfield To statalist@hsphsun2.harvard.edu Subject Re: st: SVY medians and Elixhauser Date Sun, 14 Apr 2013 22:11:14 -0700

```Hi Steve (thanks for the reference) and Stas- I had some trouble with
epctile and wanted to get your opinion on whether this is ‘legal’
(legitimate) to do.

1.  I tried to get median ages for my patients with portal vein
thrombosis (pvt) for both those with& without cirrhosis, but I had
some strata with single observations.

2.  I identified the strata and excluded them (~6 observations), and
got it to work.

3.  Is ok to do? Output for non cirrhotics is below.

a.  This didn’t work:

. epctile AGE, p(50) over(cirr) svy speclab subpop(pvt if AGE>=18 & AGE<=90)

(running mean on estimation sample)

Survey: Mean estimation

Number of strata =      53          Number of obs    =    3665

Number of PSUs   =     482          Population size  =   18356

Subpop. no. obs  =    3665

Subpop. size     =   18356

Design df        =     429

0: cirr = 0

1: cirr = 1

--------------------------------------------------------------

|             Linearized

Over |       Mean   Std. Err.     [95% Conf. Interval]

-------------+------------------------------------------------

__000006     |

0 |  -.0236348          .             .           .

1 |  -.0477322          .             .           .

--------------------------------------------------------------

Note: missing standard errors because of stratum with single

sampling unit.

estimates post: matrix has missing values

r(504);

b. this did:

svydes AGE if AGE>=18 & AGE<90 & pvt==1 & cirr==0

Survey: Describing stage 1 sampling units

pweight: DISCWT

VCE: linearized

Single unit: missing

Strata 1: NIS_STRATUM

SU 1: HOSPID

FPC 1: <zero>

#Obs with  #Obs with     #Obs per included Unit

#Units    #Units   complete  missing   ----------------------------

Stratum   included  omitted     data      data      min       mean      max

--------  --------  --------  --------  --------  --------  --------  --------

2111         1*        0         1         0         1       1.0         1

2412         1*        0         1         0         1       1.0         1

3111         1*        0         1         0         1       1.0         1

3112         1*        0         1         0         1       1.0         1

3121         1*        0         1         0         1       1.0         1

4112         1*        0         1         0         1       1.0         1

4122         1*        0         4         0         4       4.0         4

--------  --------  --------  --------  --------  --------  --------  --------

51       399         0      1495         0         1       3.7        69

------------------

.  epctile AGE, p(50) svy speclab subpop(pvt if AGE>=18 & AGE<=90 &
cirr==0 & NIS_STRATUM ~=2111 & NIS_STRATUM ~=2412 & NIS_STRATUM ~=3111
& NIS_STRATUM ~=3112 & NIS_STRATUM ~=3121 & NIS_STRATUM ~=4112)

Number of strata =      44          Number of obs    =    1492

Number of PSUs   =     394          Population size  =  7486.8

Subpop. no. obs  =    1492

Subpop. size     =  7486.8

Design df        =     350

...

Percentile estimation

------------------------------------------------------------------------------

|             Linearized

AGE |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]

-------------+----------------------------------------------------------------

p50 |         56        .75    74.67   0.000     54.53003    57.46997

Mike

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```