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
[email protected]
----- Original Message -----
From: <[email protected]>
To: <[email protected]>
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 <[email protected]>
> Date: Monday, April 3, 2006 11:34 pm
> Subject: st: table error
> To: [email protected]
>
> > 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/