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

Re: st: RE: prtest and fweights

From   Roger Newson <>
Subject   Re: st: RE: prtest and fweights
Date   Mon, 27 Sep 2004 11:21:52 +0100

At 12:53 22/09/2004, Ronan M Conroy wrote:
Nick Cox wrote:

I can't comment on why not. I guess no one asked, or no one thought of doing it.
For the moment,
preserve expand
prtest restore

But beware of -expand-. If an observation represents a zero frequency, it will be retained. You will see a warning but it's a behaviour that you might not have anticipated.

I transcribe tables from papers that I am reviewing into Stata frequently, to cross-check stats, and it's easy to transcribe a zero without remembering that this will create a single observation in the expanded dataset.
A possible way around this problem is to use -expgen-, downloadable from SSC. -expgen- is an extended version of -expand-, and does not retain observations with a zero or missing value for the expression, unless the user specifies the -zero- or -missing- options. -expgen- can also generate new variables, containing the sequence number of the duplicate observation (amongst its duplicates in the new data set) and the position of its parent observation in the old data set.


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

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

* For searches and help try:

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