Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: tab frequencies


From   Neil Shephard <[email protected]>
To   [email protected]
Subject   Re: st: tab frequencies
Date   Fri, 4 Dec 2009 14:31:27 +0000

On Fri, Dec 4, 2009 at 2:03 PM, Katja Hillmann
<[email protected]> wrote:
> Hi,
>
> I have the following problem:
>
> I conducted a survey with questions concerning the satisfaction of consumers
> with regard to certain products. 1=excellent, 2=good, 3=normal, 4=bad,
> 5=very bad
>
> In some cases the label 3 (normal) was not choosen by the consumers we
> asked. Instead we place a "." for it. When I tabulate the variables, then
> stata do not give the frequency of 0  for label 3, but left it out and
> places the . as missings beneath the frequency table. How can I force Stata
> to give out the label 3 with a frequency of zero:
>
> excellent
> good
> normal 0
> bad
> very bad
>
> instead of
>
>
>     satis |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>  excellent |          3       33.33       33.33
>      good |          1       11.11       44.44
>       bad |          2       22.22       66.67
>  very bad |          3       33.33      100.00
> ------------+-----------------------------------
>     Total |          9      1
>
>
> ???

Read the -man tabulate- page and you will see that there is a -,
missing- option which when specified will include the missing variable
in the table.  Unfortunately since Stata treats '.' (missing) as a
number higher than any other number this will always come out as....

     satis |      Freq.     Percent        Cum.
 ------------+-----------------------------------
  excellent |          3       33.33       33.33
      good |          1       11.11       44.44
       bad |          2       22.22       66.67
  very bad |          3       33.33      100.00
    normal |         0       0.00      100.00
 ------------+-----------------------------------
     Total |          9      1

The other option is to simply...

replace satis = 3 if(satis == .)

...before doing your tabulation.

Neil


-- 
"The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data." ~ John Tukey (1986), "Sunset salvo". The American
Statistician 40(1).

Email - [email protected]
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index