Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: table with zero rows


From   Garry Anderson <g.anderson@unimelb.edu.au>
To   statalist@hsphsun2.harvard.edu
Subject   st: RE: table with zero rows
Date   Thu, 04 Sep 2008 05:37:55 +1000

Hi Jeph
 
-ssc install fre-
 
-fre myvar , include(1 (1) 5)-
 
Cheers, Garry

________________________________

From: owner-statalist@hsphsun2.harvard.edu on behalf of Jeph Herrin
Sent: Thu 04/09/08 05:16
To: statalist@hsphsun2.harvard.edu
Subject: st: table with zero rows




Sometimes a variable which takes sequential integer
values does not take all possible values that it could.
For instance, -myvar- may represent a survey response
on a scale of 1 to 5, but no respondents chose "3".

I would like to generate frequency tables for such variables
that include rows for the unused values. So

       myvar |      Freq.     Percent        Cum.
------------+-----------------------------------
           1 |         37       17.54       17.54
           2 |        169       80.09       97.63
           3 |          0        0.00       97.63
           4 |          5        2.37      100.00
           5 |          0        0.00      100.00
------------+-----------------------------------
       Total |        211      100.00


Now, I can see how to write the do-file, but I keep
putting it off in the hopes of finding some trick
(or existing program) that will do the job.

Is there one?

thanks in advance,
Jeph


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


<<winmail.dat>>




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