Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Frequencies and string variables


From   Roger Newson <[email protected]>
To   [email protected]
Subject   st: Re: Frequencies and string variables
Date   Tue, 24 Feb 2004 14:02:32 +0000

At 08:42 24/02/04 -0500, W. Robert Newberry wrote:
Here's a dumb newbie question: how do I generate frequencies of string variables?

What I have is data with gender coded as "M" or "F", and I want to know the relative frequencies. Were I in SAS, I'd use Proc Freq, but the same approach doesn't seem to worth with Stata. A little help, please?
The -tabulate- command will do this, if you only want your frequencies and percentages to be displayed, and not saved.

You do not say what version of Stata you have. However, if it is Stata 8, then the nearest equivalent to -proc freq- is the -xcontract- package, downloadable from SSC. This allows the user to list frequencies and percentages and/or save them in an output data set, just like -proc freq-. To find out more, type

ssc desc xcontract

in Web-aware Stata. The -xcollapse- package is also downloadable from SSC, and does a similar job to -proc means- or -proc summary- in SAS.

I hope this helps.

Roger


--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://www.kcl-phs.org.uk/rogernewson

Opinions expressed are those of the author, not the institution.

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