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

st: Re: How do you drop the variable -(e)- from the data?


From   Roger Newson <[email protected]>
To   [email protected]
Subject   st: Re: How do you drop the variable -(e)- from the data?
Date   Thu, 06 Nov 2003 13:34:48 +0000

At 11:58 06/11/03 +0000, Nick Cox wrote:
xcontract foreign rep78, list(, sepby(foreign))

is evidently legal. Does that solve part of the problem?

Nick
[email protected]

Yes. In fact, it solves all the problem. So the problem was simply the expansion of the unexpanded "*" varlist. I should therefore add square brackets to the varlist in the -list()- option of the syntax of -xcontract-, -xcollapse-, -parmby- and -parmest-, because

list(varlist [if exp] [in range] [, list_options ] )

should really be

list( [varlist] [if exp] [in range] [, list_options ] )

Thanks for solving my problem. (And thanks in advance to StataCorp for fixing the feature and reducing possible confusion amongst naive users who might use "*" just the same.)

Roger


Roger Newson
>
> The reason I wanted to drop "(e)" was that it was causing
> confusing output
> to come from my -xcollapse- and -xcontract- packages,
> downloadable from SSC
> or from my website. These are extended versions of -collapse- and
> -contract-, respectively, and create output data sets that
> can be listed
> and/or saved to disk and/or saved to memory (overwriting
> any existing
> data). If the user types, in Stata 8,
>
> sysuse auto, clear
> regress mpg weight
> xcontract foreign rep78, list(*, sepby(foreign))
>
> then -xcontract- lists the frequencies of each combination
> of -foreign- and
> -rep78-, both as numbers and as a percentage of all cars,
> and also lists
> the variable "(e)", which could be confusing for naive
> users. It is helpful
> to know that this will be fixed, and that, in the meantime,
> "(e)" will not
> be saved to the output data set produced by the -saving()-
> option of
> -xcontract- or -xcollapse-.

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

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