Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: clogit:determining number of observations for each level of a categorical variable

 From Jacob Fowles To statalist@hsphsun2.harvard.edu Subject Re: st: clogit:determining number of observations for each level of a categorical variable Date Mon, 27 Jun 2011 11:46:50 -0500

```Daniel,

I have used the user written command by Longton and Cox named
"distinct" for this exact purpose ("ssc install distinct").  There is
also a Stata FAQ on
this subject that provides some other strategies:

http://www.stata.com/support/faqs/data/distinct.html

Hope this helps.

Best,

Jacob

Jacob Fowles
Assistant Professor
University of Kansas
785-864-3527
jacob.fowles@ku.edu
Jacob

On Mon, Jun 27, 2011 at 9:36 AM, Daniel Herbert Opi
<opi.herbert@gmail.com> wrote:
> Dear Statalist,
> I am new to Statalist and had a question that I hope I can get some
> input on. I am carrying out conditional logistic regression-clogit
> (example below) on a case control study where each case has been
> matched to a control to look at the effect of several independent
> categorical variables (xyz and abc in my example) on a dependent
> variable of disease outcome (disease). The output in stata shows the
> total number of observations used for the analysis (326 in this case)
> but I was wondering whether there is a way of determining the number
> of observations used for each level of the independent categorical
> variables (xyz and abc) since I can already tell some observations (65
> in this case) have been dropped because of having all positive or
> negative outcomes.
>
> . clogit disease i.xyz i.abc, strata (set1) or
> note: 65 groups (65 obs) dropped because of all positive or
>       all negative outcomes.
> Iteration 0:   log likelihood = -107.72902
> Iteration 1:   log likelihood = -107.64854
> Iteration 2:   log likelihood = -107.64852
> Iteration 3:   log likelihood = -107.64852
> Conditional (fixed-effects) logistic regression   Number of obs   =        326
>                                                   LR chi2(4)      =      10.67
>                                                   Prob > chi2     =     0.0305
> Log likelihood = -107.64852                       Pseudo R2       =     0.0472
> ------------------------------------------------------------------------------
>      disease | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
>          xyz |
>           1  |   2.380791    .951431     2.17   0.030      1.08782    5.210571
>           2  |    2.73225    1.09711     2.50   0.012     1.243735    6.002232
>              |
>          abc |
>           1  |   .5346201   .1450661    -2.31   0.021     .3141063    .9099424
>           2  |   .9274642   .3857671    -0.18   0.856     .4104408    2.095771
> ------------------------------------------------------------------------------
>
> Regards
>
> Daniel
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

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