Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Combining 7 variables with the same output into a single frequency table
From
Richard Goldstein <[email protected]>
To
[email protected]
Subject
Re: st: Combining 7 variables with the same output into a single frequency table
Date
Wed, 13 Feb 2013 16:47:13 -0500
it is not clear what you are looking for
if you want the sum of the variables use -egen- with the rowtotal option
if you want to know whether any of the variables have a "1", use -egen-
with the rowmax option
if you want something else, please clarify
Rich
On 2/13/13 4:39 PM, Astha Ramaiya wrote:
> Dear Nicholas,
>
> I have 7 different variables (fever 1, fever 2, fever 3….fever7) with the same output (0=No, 1 = Yes). I want to combine all these variables so that i can calculate prevalence of the morbidity. For example:
>
> Fever 1-7 give the output:
>
> m_fever1 | Freq. Percent Cum.
> ------------+-----------------------------------
> 1 | 50 14.3 14.7
> 2 | 300 85.7 100.00
> ------------+-----------------------------------
> Total | 350 100.00
>
>
> m_fever2 | Freq. Percent Cum.
> ------------+-----------------------------------
> 1 | 0 0 0
> 2 | 350 100.00 100.00
> ------------+-----------------------------------
> Total | 350 100.00
>
> m_fever3 | Freq. Percent Cum.
> ------------+-----------------------------------
> 1 | 100 28.6 28.6
> 2 | 250 71.4 100.00
> ------------+-----------------------------------
> Total | 350 100.00
>
> How can i combine the 3 tables above to give me the following table?
>
> m_fever | Freq. Percent Cum.
> ------------+-----------------------------------
> 1 | 150 14.3 14.7
> 2 | 900 85.7 100.00
> ------------+-----------------------------------
> Total | 1050 100.00
>
> I have been trying to find something the entire day but haven't been successful. Any help would be very much appreciated.
>
> Regards,
>
> Astha.
*
* 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/