Statalist The Stata Listserver


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

Re: st: table error


From   "Kerry Kammire" <kkammire@stata.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: table error
Date   Tue, 4 Apr 2006 16:54:59 -0500

Scott Merryman gave a good explanation of the reason pweights aren't allowed
with the "sd" statistic in the -table- command. The correct error message
for this situation has been added to the -table- command will be available
in an upcoming update.

 --Kerry
    kkammire@stata.com

----- Original Message ----- 
From: <smerryman@kc.rr.com>
To: <statalist@hsphsun2.harvard.edu>
Sent: Tuesday, April 04, 2006 6:52 AM
Subject: Re: st: table error


> The problem is the standard deviation.  -table- calls -collapse- which
> does not allow  sd with pweighted data (see -help collapse- or  [D]
> collapse).
>
>
> . sysuse auto,clear
> (1978 Automobile Data)
>
> . table foreign [pw=weight], c(mean price n price )
>
> ------------------------------------
>  Car type | mean(price)     N(price)
> ----------+-------------------------
>  Domestic |     6,500.6      172,490
>   Foreign |     6,799.1       50,950
> ------------------------------------
>
> . table foreign [pw=weight], c(mean price n price sd mpg)
> variable __000004 not found
> r(111);
>
>
> Unfortunately, -table- does pass along the error message from -
> collapse-.  If you -set trace on- you would see:
>
> ...
> --------- begin collapse._sd ---
>     - args y x wt w by
>     - if (`"`w'"'=="") local w 1
>     = if (`"__000004"'=="") local w 1
>     - else {
>     - if `"`wt'"'=="pweight" {
>     = if `"pweight"'=="pweight" {
>     - di as err "sd not allowed with pweights"
>     - exit 135
>       }
>       }
> ...
>
>
> Scott
>
> ----- Original Message -----
> From: Michael Hout <mikehout@berkeley.edu>
> Date: Monday, April 3, 2006 11:34 pm
> Subject: st: table error
> To: statalist@hsphsun2.harvard.edu
>
> > Dear Statalisters:
> >
> > Running table with pweight gives a mysterious error message:
> >
> > .table foreign [pw=weight], c(mean price sd price n price)
> > variable __000003 not found
> > r(111);
> >
> > -Mike Hout
> > Sociology, Berkeley
> > PS
> > .table foreign [pw=weight], c(mean price sd price n price)
> > runs fine.
>
>
> *
> *   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/
>


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index