Statalist


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

Re: st: -tabulate- and ratio "number of 1/number of 0"


From   Philip Ryan <[email protected]>
To   [email protected]
Subject   Re: st: -tabulate- and ratio "number of 1/number of 0"
Date   Wed, 6 Feb 2008 22:33:03 +1030

You wish to display the odds. One possible solution uses -tabodds-.

Unfortunately -tabodds- does not allow the -by- constrcution, but you could knit
your own using -levelsof-.  For example:

sysuse auto, clear
levelsof rep78, local(levs)
foreach x of local levs {
display _new as text "rep78 = `x'"
tabodds foreign if rep78==`x'
}

If you didn't want the entire output of -tabodds- then you could extract the
r(odds) scalar from the -return list- and just display that.

Phil



Quoting Herve STOLOWY <[email protected]>:

> Dear Statalisters:
>
> I have a dummy variable "small_profit" and use the -tabulate- command
> for several countries (see output excerpt below).
>
> bysort country: tabulate small_profit
>
>
-------------------------------------------------------------------------------------------------------------------
> -> country = AUS
>
> small_profi |
>           t |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>           0 |      2,651       56.52       56.52
>           1 |      2,039       43.48      100.00
> ------------+-----------------------------------
>       Total |      4,690      100.00
>
> I am looking for a way to get the ratio: number of "1"/number of "0".
>
> I read the help of -tabulate- and -table- but did not find a solution.
>
> Would you have any thoughts?
>
> Best regards
>
> Hervé Stolowy
>
> ***********************************************************
> Professeur/Professor
> HEC Paris
> Département Comptabilité Contrôle de gestion / Dept of Accounting and
> Management Control
> 1, rue de la Liberation
> 78351 - Jouy-en-Josas
> France
> Tel: +33 1 39 67 94 42 - Fax: +33 1 39 67 70 86
> mail: stolowy at hec dot fr
> web: http://www.hec.fr/stolowy
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>


-- 
Philip Ryan
Professor
Discipline of Public Health

Director, Data Management and Analysis Centre
Associate Dean (IT)
Faculty of Health Sciences

University of Adelaide
5005 South Australia
AUSTRALIA
CRICOS Provider Number 00123M
-----------------------------------------------------------
This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright.  If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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