Statalist The Stata Listserver


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

Re: st: table error


From   [email protected]
To   [email protected]
Subject   Re: st: table error
Date   Tue, 04 Apr 2006 06:52:52 -0500

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/



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